Merge with 3.1

This commit is contained in:
Ronald Oussoren 2011-03-16 09:43:06 -04:00
commit f0edd1b86d
3 changed files with 9 additions and 1 deletions

View file

@ -115,8 +115,11 @@ def cpu_count():
except (ValueError, KeyError):
num = 0
elif 'bsd' in sys.platform or sys.platform == 'darwin':
comm = '/sbin/sysctl -n hw.ncpu'
if sys.platform == 'darwin':
comm = '/usr' + comm
try:
with os.popen('sysctl -n hw.ncpu') as p:
with os.popen(comm) as p:
num = int(p.read())
except ValueError:
num = 0