mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 15:22:59 +01:00
buildPythonPackage: Add --old-and-unmanageable flag to install command and add more docs.
For explanation see inline comments.
This commit is contained in:
parent
c80feaf542
commit
b1ffb9ede4
1 changed files with 21 additions and 10 deletions
|
@ -7,15 +7,16 @@
|
|||
|
||||
{ name
|
||||
|
||||
# by default prefix name with python version name, e.g. "python3.3-"
|
||||
# by default prefix `name` e.g. "python3.3-${name}"
|
||||
, namePrefix ? python.libPrefix + "-"
|
||||
|
||||
, buildInputs ? []
|
||||
|
||||
# TODO: document
|
||||
# pass extra information to the distutils global configuration (think as global setup.cfg)
|
||||
, distutilsExtraCfg ? ""
|
||||
|
||||
# TODO: say what it does
|
||||
# propagate build dependencies so in case we have A -> B -> C,
|
||||
# C can import propagated packages by A
|
||||
, propagatedBuildInputs ? []
|
||||
|
||||
# passed to "python setup.py install"
|
||||
|
@ -71,6 +72,7 @@ python.stdenv.mkDerivation (attrs // {
|
|||
checkPhase = attrs.checkPhase or ''
|
||||
runHook preCheck
|
||||
|
||||
# reduce output to only dots, if a test fails error output will include verbose info
|
||||
${python}/bin/${python.executable} setup.py test -q
|
||||
|
||||
runHook postCheck
|
||||
|
@ -91,7 +93,16 @@ python.stdenv.mkDerivation (attrs // {
|
|||
|
||||
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
||||
|
||||
${python}/bin/${python.executable} setup.py install --install-lib=$out/lib/${python.libPrefix}/site-packages \
|
||||
${python}/bin/${python.executable} setup.py install \
|
||||
# sometimes packages specify where files should be installed outside the usual
|
||||
# python lib prefix, we override that back so all infrastructure (setup hooks)
|
||||
# work as expected
|
||||
--install-lib=$out/lib/${python.libPrefix}/site-packages \
|
||||
# instruct setuptools not to use eggs but fallback to plan package install
|
||||
# this also reduces one .pth file in the chain, but the main reason is to
|
||||
# force install process to install only scripts for the package we are
|
||||
# installing (otherwise it will install scripts also for dependencies)
|
||||
--old-and-unmanageable \
|
||||
--prefix="$out" ${lib.concatStringsSep " " setupPyInstallFlags}
|
||||
|
||||
# A pth file might have been generated to load the package from
|
||||
|
@ -116,14 +127,14 @@ python.stdenv.mkDerivation (attrs // {
|
|||
wrapPythonPrograms
|
||||
|
||||
# If a user installs a Python package, they probably also wants its
|
||||
# dependencies in the user environment (since Python modules don't
|
||||
# have something like an RPATH, so the only way to find the
|
||||
# dependencies in the user environment profile (only way to find the
|
||||
# dependencies is to have them in the PYTHONPATH variable).
|
||||
# TODO: better docs
|
||||
# Allows you to do: $ PYTHONPATH=~/.nix-profile/lib/python2.7/site-packages python
|
||||
if test -e $out/nix-support/propagated-build-inputs; then
|
||||
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
||||
fi
|
||||
|
||||
# TODO: document
|
||||
createBuildInputsPth build-inputs "$buildInputStrings"
|
||||
for inputsfile in propagated-build-inputs propagated-native-build-inputs; do
|
||||
if test -e $out/nix-support/$inputsfile; then
|
||||
|
@ -135,9 +146,9 @@ python.stdenv.mkDerivation (attrs // {
|
|||
meta = {
|
||||
# default to python's platforms
|
||||
platforms = python.meta.platforms;
|
||||
} // meta // {
|
||||
} // meta // with lib.maintainers; {
|
||||
# add extra maintainer(s) to every package
|
||||
maintainers = (meta.maintainers or []) ++ [ lib.maintainers.chaoflow lib.maintainers.iElectric ];
|
||||
maintainers = (meta.maintainers or []) ++ [ chaoflow iElectric ];
|
||||
};
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue