From 01296d775d65f90688ada5df535ece01ab958596 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Tue, 23 Nov 2021 21:47:22 +0000 Subject: [PATCH] python3Packages.pyeclib: fix for darwin --- pkgs/development/python-modules/pyeclib/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/pyeclib/default.nix b/pkgs/development/python-modules/pyeclib/default.nix index 2c4169ea73ca..d55fb416a79e 100644 --- a/pkgs/development/python-modules/pyeclib/default.nix +++ b/pkgs/development/python-modules/pyeclib/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, liberasurecode, six }: +{ lib, stdenv, buildPythonPackage, fetchPypi, liberasurecode, six }: buildPythonPackage rec { pname = "pyeclib"; @@ -13,11 +13,16 @@ buildPythonPackage rec { # patch dlopen call substituteInPlace src/c/pyeclib_c/pyeclib_c.c \ --replace "liberasurecode.so" "${liberasurecode}/lib/liberasurecode.so" + # python's platform.platform() doesn't return "Darwin" (anymore?) + substituteInPlace setup.py \ + --replace '"Darwin"' '"macOS"' ''; - preBuild = '' - # required for the custom find_library function in setup.py - export LD_LIBRARY_PATH="${lib.makeLibraryPath [ liberasurecode ]}" + preBuild = let + ldLibraryPathEnvName = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; + in '' + # required for the custom _find_library function in setup.py + export ${ldLibraryPathEnvName}="${lib.makeLibraryPath [ liberasurecode ]}" ''; buildInputs = [ liberasurecode ];