~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-06-04 09:57:28 UTC
  • mfrom: (4406.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090604095728-2ch869kqc0dhxxpp
(vila) Add cpu # detection for OSX

Show diffs side-by-side

added added

removed removed

Lines of Context:
3062
3062
    try:
3063
3063
        content = file('/proc/cpuinfo', 'rb').read()
3064
3064
        concurrency = cpucount(content)
3065
 
    except Exception, e:
 
3065
        return concurrency
 
3066
    except IOError:
 
3067
        pass
 
3068
 
 
3069
    try:
 
3070
       output = Popen(['sysctl', '-n', 'hw.availcpu'],
 
3071
                      stdout=PIPE).communicate()[0]
 
3072
       concurrency = int(output)
 
3073
       return concurrency
 
3074
    except (OSError, IOError):
3066
3075
        concurrency = 1
 
3076
 
3067
3077
    return concurrency
3068
3078
 
3069
3079