treewide: Use *Platform.extensions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -11689,7 +11685,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;
|
||||
@@ -11711,7 +11707,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 ];
|
||||
@@ -24228,11 +24224,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
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user