On Wed, Dec 14, 2016 at 12:48 PM, Nathan Zachary
<nathanzach...@gentoo.org> wrote:
> On 14/12/16 10:11, Doug Freed wrote:
>> On Wed, Dec 14, 2016 at 11:04 AM, Michał Górny <mgo...@gentoo.org> wrote:
>>> On Wed, 14 Dec 2016 15:27:25 +0300
>>> Andrew Savchenko <birc...@gentoo.org> wrote:
>>>
>>>> On Tue, 13 Dec 2016 10:36:15 +0100 Michał Górny wrote:
>>>>> +           nproc=$(python -c 'import multiprocessing; 
>>>>> print(multiprocessing.cpu_count());' 2>/dev/null)
>>>> This is not portable. E.g. paludis users can have python-less
>>>> system. Adding dev-lang/python to DEPEND will be also a bad idea,
>>>> since this is quite heavy dependency.
>>> You can bikeshed potential circumstances where it wouldn't work for
>>> the next year. Which doesn't change that it would work quite reliably
>>> for the most of Gentoo users.
>>>
>>>> Since on Linux boxes nproc is from coreutils, which is in @system,
>>>> so looks like only *bsd setups are the problem. On FreeBSD
>>> ...and all other operating systems (see: Prefix).
>>>
>>>>   sysctl -a | egrep -i 'hw.ncpu'
>>> I somehow doubt that would give me the expected number only, and I lack
>>> a BSD install handy to test it.
>> $(sysctl -n hw.ncpu)
>>
> I don't know that the sysctl command works universally:
>
> # sysctl -n hw.ncpu
> sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory
>

It's BSD-specific (Darwin may have it too, but I'm not in OS X at the
moment, so I can't check), which pretty much describes this branch in
the codepath as well.  Linux users will have the nproc command from
coreutils.

-Doug

Reply via email to