mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 15:22:59 +01:00
python3Packages.datatable: fix the Darwin build (#65613)
This commit is contained in:
parent
ed5ed93422
commit
b1f0e2ace1
4 changed files with 99 additions and 6 deletions
|
@ -1,11 +1,16 @@
|
||||||
{ lib
|
{ blessed
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, fetchPypi
|
, fetchPypi
|
||||||
, pythonOlder
|
, lib
|
||||||
|
, libcxx
|
||||||
|
, libcxxabi
|
||||||
, llvm
|
, llvm
|
||||||
, typesentry
|
, openmp
|
||||||
, blessed
|
|
||||||
, pytest
|
, pytest
|
||||||
|
, pythonOlder
|
||||||
|
, stdenv
|
||||||
|
, substituteAll
|
||||||
|
, typesentry
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
|
@ -17,10 +22,25 @@ buildPythonPackage rec {
|
||||||
sha256 = "1s8z81zffrckvdwrrl0pkjc7gsdvjxw59xgg6ck81dl7gkh5grjk";
|
sha256 = "1s8z81zffrckvdwrrl0pkjc7gsdvjxw59xgg6ck81dl7gkh5grjk";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# Disable the compiler monkey patching, and remove the task that's copying
|
||||||
|
# the native dependencies to the build directory.
|
||||||
|
./remove-compiler-monkeypatch_disable-native-relocation.patch
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
|
# Replace the library auto-detection with hardcoded paths.
|
||||||
|
(substituteAll {
|
||||||
|
src = ./hardcode-library-paths.patch;
|
||||||
|
|
||||||
|
libomp_dylib = "${lib.getLib openmp}/lib/libomp.dylib";
|
||||||
|
libcxx_dylib = "${lib.getLib libcxx}/lib/libc++.1.dylib";
|
||||||
|
libcxxabi_dylib = "${lib.getLib libcxxabi}/lib/libc++abi.dylib";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
disabled = pythonOlder "3.5";
|
disabled = pythonOlder "3.5";
|
||||||
|
|
||||||
propagatedBuildInputs = [ typesentry blessed ];
|
propagatedBuildInputs = [ typesentry blessed ];
|
||||||
buildInputs = [ llvm ];
|
buildInputs = [ llvm ] ++ lib.optionals stdenv.isDarwin [ openmp ];
|
||||||
checkInputs = [ pytest ];
|
checkInputs = [ pytest ];
|
||||||
|
|
||||||
LLVM = llvm;
|
LLVM = llvm;
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
diff --git a/ci/setup_utils.py b/ci/setup_utils.py
|
||||||
|
index 66b385a..6255af0 100644
|
||||||
|
--- a/ci/setup_utils.py
|
||||||
|
+++ b/ci/setup_utils.py
|
||||||
|
@@ -600,37 +600,7 @@ def find_linked_dynamic_libraries():
|
||||||
|
them as a list of absolute paths.
|
||||||
|
"""
|
||||||
|
with TaskContext("Find the required dynamic libraries") as log:
|
||||||
|
- llvm = get_llvm()
|
||||||
|
- libs = required_link_libraries()
|
||||||
|
- resolved = []
|
||||||
|
- for libname in libs:
|
||||||
|
- if llvm:
|
||||||
|
- fullpath = os.path.join(llvm, "lib", libname)
|
||||||
|
- if os.path.isfile(fullpath):
|
||||||
|
- resolved.append(fullpath)
|
||||||
|
- log.info("Library `%s` found at %s" % (libname, fullpath))
|
||||||
|
- continue
|
||||||
|
- else:
|
||||||
|
- log.info("%s does not exist" % fullpath)
|
||||||
|
- # Rely on the shell `locate` command to find the dynamic libraries.
|
||||||
|
- proc = subprocess.Popen(["locate", libname], stdout=subprocess.PIPE,
|
||||||
|
- stderr=subprocess.PIPE)
|
||||||
|
- stdout, stderr = proc.communicate()
|
||||||
|
- if proc.returncode == 0:
|
||||||
|
- results = stdout.decode().strip().split("\n")
|
||||||
|
- results = [r for r in results if r]
|
||||||
|
- if results:
|
||||||
|
- results.sort(key=len)
|
||||||
|
- fullpath = results[0]
|
||||||
|
- assert os.path.isfile(fullpath), "Invalid path: %r" % (fullpath,)
|
||||||
|
- resolved.append(fullpath)
|
||||||
|
- log.info("Library `%s` found at %s" % (libname, fullpath))
|
||||||
|
- continue
|
||||||
|
- else:
|
||||||
|
- log.fatal("Cannot locate dynamic library `%s`" % libname)
|
||||||
|
- else:
|
||||||
|
- log.fatal("`locate` command returned the following error:\n%s"
|
||||||
|
- % stderr.decode())
|
||||||
|
+ resolved = ["@libomp_dylib@", "@libcxx_dylib@", "@libcxxabi_dylib@"]
|
||||||
|
return resolved
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 58fc875..8032561 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -141,23 +141,6 @@ if cmd in ("build", "bdist_wheel", "build_ext", "install"):
|
||||||
|
extra_link_args = get_extra_link_args()
|
||||||
|
cpp_files = get_c_sources("c")
|
||||||
|
|
||||||
|
- with TaskContext("Copy dynamic libraries") as log:
|
||||||
|
- # Copy system libraries into the datatable/lib folder, so that they can
|
||||||
|
- # be packaged with the wheel
|
||||||
|
- libs = find_linked_dynamic_libraries()
|
||||||
|
- for libpath in libs:
|
||||||
|
- trgfile = os.path.join("datatable", "lib",
|
||||||
|
- os.path.basename(libpath))
|
||||||
|
- if os.path.exists(trgfile):
|
||||||
|
- log.info("File %s already exists, skipped" % trgfile)
|
||||||
|
- else:
|
||||||
|
- log.info("Copying %s to %s" % (libpath, trgfile))
|
||||||
|
- shutil.copy(libpath, trgfile)
|
||||||
|
-
|
||||||
|
- if ismacos():
|
||||||
|
- monkey_patch_compiler()
|
||||||
|
-
|
||||||
|
-
|
||||||
|
# Create the git version file
|
||||||
|
if cmd in ("build", "sdist", "bdist_wheel", "install"):
|
||||||
|
make_git_version_file(True)
|
|
@ -482,7 +482,9 @@ in {
|
||||||
|
|
||||||
btchip = callPackage ../development/python-modules/btchip { };
|
btchip = callPackage ../development/python-modules/btchip { };
|
||||||
|
|
||||||
datatable = callPackage ../development/python-modules/datatable { };
|
datatable = callPackage ../development/python-modules/datatable {
|
||||||
|
inherit (pkgs.llvmPackages) openmp libcxx libcxxabi;
|
||||||
|
};
|
||||||
|
|
||||||
datamodeldict = callPackage ../development/python-modules/datamodeldict { };
|
datamodeldict = callPackage ../development/python-modules/datamodeldict { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue