~debian-bazaar/bzr/2.4

« back to all changes in this revision

Viewing changes to debian/patches/04_kfreebsd_cpu_count

  • Committer: Jelmer Vernooij
  • Date: 2011-11-07 16:16:20 UTC
  • mfrom: (3815.3067.1)
  • Revision ID: jelmer@samba.org-20111107161620-841y704yt2zq8ftd
Fix bzrlib.osutils.local_concurrency() when used on GNU/kFreeBSD
with Python's multiprocessing module available. Closes: #647690

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Fix concurrency count determination on Debian GNU/kFreeBSD
 
2
Author: Jelmer Vernooij <jelmer@debian.org>
 
3
Status: Submitted for inclusion upstream, https://code.launchpad.net/~jelmer/bzr/cpu-count-bsd/+merge/81458
 
4
 
 
5
=== modified file 'bzrlib/osutils.py'
 
6
--- a/bzrlib/osutils.py 2011-10-12 16:00:13 +0000
 
7
+++ b/bzrlib/osutils.py 2011-11-07 15:08:19 +0000
 
8
@@ -2323,7 +2323,14 @@
 
9
             except (OSError, IOError):
 
10
                 pass
 
11
         else:
 
12
-            concurrency = multiprocessing.cpu_count()
 
13
+            # multiprocessing.cpu_count() isn't implemented on all platforms
 
14
+            try:
 
15
+                concurrency = multiprocessing.cpu_count()
 
16
+            except NotImplementedError:
 
17
+                try:
 
18
+                    concurrency = _local_concurrency()
 
19
+                except (OSError, IOError):
 
20
+                    pass
 
21
     try:
 
22
         concurrency = int(concurrency)
 
23
     except (TypeError, ValueError):
 
24