From: Yaroslav Halchenko <debian@onerussian.com>
Subject: joblib uses .Pool which requres locking to be available on the platform

e.g. needed on kfreebsd systems  -- otherwise would try to initiate the .Pool
and would backtrace -- leads to FTBFS of any package which excercizes
build-time tests using joblib, e.g. statsmodels

Origin: Debian
Forwarded: https://github.com/joblib/joblib/pull/39
Last-Update: 2012-07-16

--- a/joblib/parallel.py
+++ b/joblib/parallel.py
@@ -28,6 +28,16 @@ if multiprocessing:
     except ImportError:
         multiprocessing = None
 
+# 2nd stage: validate that locking is available on the system and
+#            issue a warning if not
+if multiprocessing:
+    try:
+        _sem = multiprocessing.Semaphore()
+        del _sem # cleanup
+    except (ImportError, OSError), e:
+        multiprocessing = None
+        warnings.warn('%s.  joblib will operate in serial mode' % (e,))
+
 from .format_stack import format_exc, format_outer_frames
 from .logger import Logger, short_format_time
 from .my_exceptions import TransportableException, _mk_exception
