summary refs log tree commit diff
path: root/pkgs/top-level
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2017-09-13 11:20:06 -0400
committerGitHub <noreply@github.com>2017-09-13 11:20:06 -0400
commit8fccaa284d8e51eac2a97a6ca3a3c28d78592008 (patch)
tree825f6ba8235e92abf899c070569b179ed6c9b122 /pkgs/top-level
parent98d84b1375971627d3e5eac9065c4b1dc304b009 (diff)
parent5aec3f96a26806dc26759bc2f13b062caaad3c17 (diff)
downloadnixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.tar
nixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.tar.gz
nixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.tar.bz2
nixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.tar.lz
nixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.tar.xz
nixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.tar.zst
nixlib-8fccaa284d8e51eac2a97a6ca3a3c28d78592008.zip
Merge pull request #29282 from obsidiansystems/soext
lib, treewide: Add `*Platform.extensions` and use it where possible
Diffstat (limited to 'pkgs/top-level')
-rw-r--r--pkgs/top-level/python-packages.nix15
1 files changed, 4 insertions, 11 deletions
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index fe82dc9d1d05..9edf6571a527 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -80,14 +80,10 @@ let
         else throw "Unsupported kind ${kind}");
     in fetcher (builtins.removeAttrs attrs ["format"]) );
 
-  # This should become part of stdenv!
-  sharedLibraryExtension = if stdenv.isDarwin then ".dylib" else ".so";
-
 in {
 
   inherit python bootstrapped-pip pythonAtLeast pythonOlder isPy26 isPy27 isPy33 isPy34 isPy35 isPy36 isPyPy isPy3k mkPythonDerivation buildPythonPackage buildPythonApplication;
   inherit fetchPypi callPackage;
-  inherit sharedLibraryExtension;
 
   # helpers
 
@@ -11647,7 +11643,7 @@ in {
     propagatedBuildInputs = with self; [ pkgs.file ];
 
     patchPhase = ''
-      substituteInPlace magic.py --replace "ctypes.util.find_library('magic')" "'${pkgs.file}/lib/libmagic.${if stdenv.isDarwin then "dylib" else "so"}'"
+      substituteInPlace magic.py --replace "ctypes.util.find_library('magic')" "'${pkgs.file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'"
     '';
 
     doCheck = false;
@@ -11669,7 +11665,7 @@ in {
     src = pkgs.file.src;
 
     patchPhase = ''
-      substituteInPlace python/magic.py --replace "find_library('magic')" "'${pkgs.file}/lib/libmagic.${if stdenv.isDarwin then "dylib" else "so"}'"
+      substituteInPlace python/magic.py --replace "find_library('magic')" "'${pkgs.file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'"
     '';
 
     buildInputs = with self; [ pkgs.file ];
@@ -24184,11 +24180,8 @@ EOF
 
     # Fix the USB backend library lookup
     postPatch =
-      let
-        # This should really be in the stdenv somewhere
-        soext = if stdenv.isLinux then "so" else if stdenv.isDarwin then "dylib" else throw "Unsupported platform";
-      in ''
-        libusb=${pkgs.libusb1.out}/lib/libusb-1.0.${soext}
+      ''
+        libusb=${pkgs.libusb1.out}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}
         test -f $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; }
         sed -i -e "s|find_library=None|find_library=lambda _:\"$libusb\"|" usb/backend/libusb1.py
       '';