diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-07-13 13:26:39 +0200 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2019-07-15 17:47:57 +0200 |
commit | 7da15d9b36ea115d5cd25a2c837867fffac3c192 (patch) | |
tree | b70b61b63ec055f402f2c3973f43d7074cf47026 /pkgs/development/interpreters | |
parent | e92a2f2fc2b5ca13c6223c08ac8e1fd5a7bd66dc (diff) | |
download | nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.tar nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.tar.gz nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.tar.bz2 nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.tar.lz nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.tar.xz nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.tar.zst nixpkgs-7da15d9b36ea115d5cd25a2c837867fffac3c192.zip |
buildPythonPackage: add support for setupPyGlobalFlags (2)
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r-- | pkgs/development/interpreters/python/build-python-package-pyproject.nix | 13 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/build-python-package-setuptools.nix | 11 |
2 files changed, 16 insertions, 8 deletions
diff --git a/pkgs/development/interpreters/python/build-python-package-pyproject.nix b/pkgs/development/interpreters/python/build-python-package-pyproject.nix index 86c450fcf92..085db44f3e8 100644 --- a/pkgs/development/interpreters/python/build-python-package-pyproject.nix +++ b/pkgs/development/interpreters/python/build-python-package-pyproject.nix @@ -5,10 +5,12 @@ }: { -# passed to "python setup.py build_ext" +# Global options passed to "python setup.py" + setupPyGlobalFlags ? [] +# Build options passed to "build_ext" # https://github.com/pypa/pip/issues/881 # Rename to `buildOptions` because it is not setuptools specific? - setupPyBuildFlags ? [] +, setupPyBuildFlags ? [] # Execute before shell hook , preShellHook ? "" # Execute after shell hook @@ -16,13 +18,14 @@ , ... } @ attrs: let - options = lib.concatMapStringsSep " " (option: "--global-option ${option}") setupPyBuildFlags; + pipGlobalFlagsString = lib.concatMapStringsSep " " (option: "--global-option ${option}") setupPyGlobalFlags; + pipBuildFlagsString = lib.concatMapStringsSep " " (option: "--build-option ${option}") setupPyBuildFlags; in attrs // { buildPhase = attrs.buildPhase or '' runHook preBuild mkdir -p dist echo "Creating a wheel..." - ${python.pythonForBuild.interpreter} -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist ${options} . + ${python.pythonForBuild.interpreter} -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist ${pipGlobalFlagsString} ${pipBuildFlagsString} . echo "Finished creating a wheel..." runHook postBuild ''; @@ -50,4 +53,4 @@ in attrs // { ${postShellHook} ''; -} \ No newline at end of file +} diff --git a/pkgs/development/interpreters/python/build-python-package-setuptools.nix b/pkgs/development/interpreters/python/build-python-package-setuptools.nix index 4c66fdec5f6..7738ea2f66a 100644 --- a/pkgs/development/interpreters/python/build-python-package-setuptools.nix +++ b/pkgs/development/interpreters/python/build-python-package-setuptools.nix @@ -5,9 +5,11 @@ }: { -# passed to "python setup.py build_ext" +# Global options passed to "python setup.py" + setupPyGlobalFlags ? [] +# Build options passed to "python setup.py build_ext" # https://github.com/pypa/pip/issues/881 - setupPyBuildFlags ? [] +, setupPyBuildFlags ? [] # Execute before shell hook , preShellHook ? "" # Execute after shell hook @@ -19,13 +21,16 @@ let # pip does the same thing: https://github.com/pypa/pip/pull/3265 setuppy = ./run_setup.py; + setupPyGlobalFlagsString = lib.concatStringsSep " " setupPyGlobalFlags; + setupPyBuildExtString = lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags)); + in attrs // { # we copy nix_run_setup over so it's executed relative to the root of the source # many project make that assumption buildPhase = attrs.buildPhase or '' runHook preBuild cp ${setuppy} nix_run_setup - ${python.pythonForBuild.interpreter} nix_run_setup ${lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags))} bdist_wheel + ${python.pythonForBuild.interpreter} nix_run_setup ${setupPyGlobalFlagsString} ${setupPyBuildExtString} bdist_wheel runHook postBuild ''; |