buildPythonPackage: write some comments

This commit is contained in:
Domen Kožar 2015-11-26 17:31:10 +01:00
parent cf5984e4bf
commit 0c772699ba

View File

@ -13,10 +13,10 @@
, buildInputs ? [] , buildInputs ? []
# propagate build dependencies so in case we have A -> B -> C, # propagate build dependencies so in case we have A -> B -> C,
# C can import propagated packages by A # C can import package A propagated by B
, propagatedBuildInputs ? [] , propagatedBuildInputs ? []
# passed to "python setup.py build" # passed to "python setup.py build_ext"
# https://github.com/pypa/pip/issues/881 # https://github.com/pypa/pip/issues/881
, setupPyBuildFlags ? [] , setupPyBuildFlags ? []
@ -50,10 +50,13 @@ then throw "${name} not supported for interpreter ${python.executable}"
else else
let let
# use setuptools shim (so that setuptools is imported before distutils)
# pip does the same thing: https://github.com/pypa/pip/pull/3265
setuppy = ./run_setup.py; setuppy = ./run_setup.py;
# For backwards compatibility, let's use an alias
doInstallCheck = doCheck;
in in
python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // { python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] // {
name = namePrefix + name; name = namePrefix + name;
buildInputs = [ wrapPython bootstrapped-pip ] ++ buildInputs ++ pythonPath buildInputs = [ wrapPython bootstrapped-pip ] ++ buildInputs ++ pythonPath
@ -62,8 +65,6 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
# propagate python/setuptools to active setup-hook in nix-shell # propagate python/setuptools to active setup-hook in nix-shell
propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ]; propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];
pythonPath = pythonPath;
configurePhase = attrs.configurePhase or '' configurePhase = attrs.configurePhase or ''
runHook preConfigure runHook preConfigure
@ -74,6 +75,8 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
runHook postConfigure runHook postConfigure
''; '';
# we copy nix_run_setup.py over so it's executed relative to the root of the source
# many project make that assumption
buildPhase = attrs.buildPhase or '' buildPhase = attrs.buildPhase or ''
runHook preBuild runHook preBuild
cp ${setuppy} nix_run_setup.py cp ${setuppy} nix_run_setup.py
@ -94,8 +97,10 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
runHook postInstall runHook postInstall
''; '';
doInstallCheck = doCheck; # We run all tests after software has been installed since that is
doCheck = false; # a common idiom in Python
doInstallCheck = doInstallCheck;
installCheckPhase = attrs.checkPhase or '' installCheckPhase = attrs.checkPhase or ''
runHook preCheck runHook preCheck
${python.interpreter} nix_run_setup.py test ${python.interpreter} nix_run_setup.py test