Rev 4407: (vila) Add cpu # detection for OSX in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jun 4 10:57:31 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4407
revision-id: pqm at pqm.ubuntu.com-20090604095728-2ch869kqc0dhxxpp
parent: pqm at pqm.ubuntu.com-20090604045950-80cudgl0j15xtgi2
parent: v.ladeuil+lp at free.fr-20090604090117-v6x1h57elfrjo7do
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-06-04 10:57:28 +0100
message:
  (vila) Add cpu # detection for OSX
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4406.1.1
    revision-id: v.ladeuil+lp at free.fr-20090604090117-v6x1h57elfrjo7do
    parent: pqm at pqm.ubuntu.com-20090604045950-80cudgl0j15xtgi2
    parent: john at szakmeister.net-20090604005741-96eyg38538vt9pwp
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: integration
    timestamp: Thu 2009-06-04 11:01:17 +0200
    message:
      Add cpu # detection for OSX
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4398.4.2
    revision-id: john at szakmeister.net-20090604005741-96eyg38538vt9pwp
    parent: john at szakmeister.net-20090603100938-7y2f0yunb254rpvb
    committer: jszakmeister <john at szakmeister.net>
    branch nick: parallel-test-fix
    timestamp: Wed 2009-06-03 20:57:41 -0400
    message:
      Catch more specific exceptions in local_concurrency().
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4398.4.1
    revision-id: john at szakmeister.net-20090603100938-7y2f0yunb254rpvb
    parent: pqm at pqm.ubuntu.com-20090602153906-1q6bresxw669b34i
    committer: jszakmeister <john at szakmeister.net>
    branch nick: parallel-test-fix
    timestamp: Wed 2009-06-03 06:09:38 -0400
    message:
      Enable parallel testing on Mac OS X.
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'NEWS'
--- a/NEWS	2009-06-03 22:29:22 +0000
+++ b/NEWS	2009-06-04 09:01:17 +0000
@@ -91,6 +91,8 @@
 Testing
 *******
 
+* The number of cores is now correctly detected on OSX. (John Szakmeister)
+
 
 bzr 1.15
 ########

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-05-23 04:55:52 +0000
+++ b/bzrlib/tests/__init__.py	2009-06-04 00:57:41 +0000
@@ -3062,8 +3062,18 @@
     try:
         content = file('/proc/cpuinfo', 'rb').read()
         concurrency = cpucount(content)
-    except Exception, e:
+        return concurrency
+    except IOError:
+        pass
+
+    try:
+       output = Popen(['sysctl', '-n', 'hw.availcpu'],
+                      stdout=PIPE).communicate()[0]
+       concurrency = int(output)
+       return concurrency
+    except (OSError, IOError):
         concurrency = 1
+
     return concurrency
 
 




More information about the bazaar-commits mailing list