Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-implement python-wrapper with buildEnv.
The new wrapper creates an environment that contains all files from Python and the extra libraries that have been specified. All files are found at run-time by means of the $PYTHONHOME variable; the wrapper no longer uses $PYTHONPATH.
- Loading branch information
Showing
1 changed file
with
13 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
# Create a python that knows about additional python packages via | ||
# PYTHONPATH | ||
{ stdenv, python, buildEnv, makeWrapper, recursivePthLoader, extraLibs ? [] }: | ||
|
||
{ stdenv, python, makeWrapper, recursivePthLoader, extraLibs ? [] }: | ||
# Create a python executable that knows about additional packages. | ||
|
||
stdenv.mkDerivation { | ||
(buildEnv { | ||
name = "python-${python.version}-wrapper"; | ||
paths = extraLibs ++ [ python makeWrapper recursivePthLoader ]; | ||
ignoreCollisions = false; | ||
|
||
propagatedBuildInputs = extraLibs ++ [ python makeWrapper recursivePthLoader ]; | ||
|
||
unpackPhase = "true"; | ||
installPhase = '' | ||
postBuild = '' | ||
. "${makeWrapper}/nix-support/setup-hook" | ||
mkdir -p "$out/bin" | ||
for prg in 2to3 idle pdb pdb${python.majorVersion} pydoc python python-config python${python.majorVersion} python${python.majorVersion}-config smtpd.py; do | ||
makeWrapper "$python/bin/$prg" "$out/bin/$prg" --suffix PYTHONPATH : "$PYTHONPATH" | ||
cd "${python}/bin" | ||
for prg in *; do | ||
echo "$prg --> $out/bin/$prg" | ||
rm -f "$out/bin/$prg" | ||
makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out" | ||
done | ||
ensureDir "$out/share" | ||
ln -s "$python/share/man" "$out/share/man" | ||
''; | ||
|
||
}) // { | ||
inherit python; | ||
inherit (python) meta; | ||
} |