summary refs log tree commit diff
path: root/pkgs/development/python-modules/cffi
diff options
context:
space:
mode:
authorDan Peebles <pumpkin@me.com>2017-10-31 12:20:22 +0100
committerDan Peebles <pumpkin@me.com>2017-11-14 21:51:40 -0500
commit10220de35ebf78555b5d164d2fb1b9b238180e80 (patch)
tree82c69d760dd0846778bdc2bb95cfe18fd760725a /pkgs/development/python-modules/cffi
parent0fe7bde3d88027977a07a24baee98d2ecc07222f (diff)
downloadnixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.tar
nixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.tar.gz
nixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.tar.bz2
nixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.tar.lz
nixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.tar.xz
nixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.tar.zst
nixlib-10220de35ebf78555b5d164d2fb1b9b238180e80.zip
Fix a couple of python modules to work in sandbox
Diffstat (limited to 'pkgs/development/python-modules/cffi')
-rw-r--r--pkgs/development/python-modules/cffi/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix
index b0524b4121ad..f8e313d660eb 100644
--- a/pkgs/development/python-modules/cffi/default.nix
+++ b/pkgs/development/python-modules/cffi/default.nix
@@ -17,6 +17,20 @@ if isPyPy then null else buildPythonPackage rec {
   propagatedBuildInputs = [ libffi pycparser ];
   buildInputs = [ pytest ];
 
+  # On Darwin, the cffi tests want to hit libm a lot, and look for it in a global
+  # impure search path. It's obnoxious how much repetition there is, and how difficult
+  # it is to get it to search somewhere else (since we do actually have a libm symlink in libSystem)
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace testing/cffi0/test_parsing.py \
+      --replace 'lib_m = "m"' 'lib_m = "System"' \
+      --replace '"libm" in name' '"libSystem" in name'
+    substituteInPlace testing/cffi0/test_unicode_literals.py --replace 'lib_m = "m"' 'lib_m = "System"'
+    substituteInPlace testing/cffi0/test_zdistutils.py --replace 'self.lib_m = "m"' 'self.lib_m = "System"'
+    substituteInPlace testing/cffi1/test_recompiler.py --replace 'lib_m = "m"' 'lib_m = "System"'
+    substituteInPlace testing/cffi0/test_function.py --replace "lib_m = 'm'" "lib_m = 'System'"
+    substituteInPlace testing/cffi0/test_verify.py --replace "lib_m = ['m']" "lib_m = ['System']"
+  '';
+
   # The tests use -Werror but with python3.6 clang detects some unreachable code.
   NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.cc.isClang [ "-Wno-unused-command-line-argument" "-Wno-unreachable-code" ];