Merge pull request #51641 from codedownio/nousersite-master
Allow skipping the use of the PYTHONNOUSERSITE variable
This commit is contained in:
commit
d801204fdd
@ -49,6 +49,9 @@
|
||||
# Skip wrapping of python programs altogether
|
||||
, dontWrapPythonPrograms ? false
|
||||
|
||||
# Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs
|
||||
, permitUserSite ? false
|
||||
|
||||
# Remove bytecode from bin folder.
|
||||
# When a Python script has the extension `.py`, bytecode is generated
|
||||
# Typically, executables in bin have no extension, so no bytecode is generated.
|
||||
|
@ -73,9 +73,12 @@ wrapPythonProgramsIn() {
|
||||
# (see pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
local -a wrap_args=("$f"
|
||||
--prefix PATH ':' "$program_PATH"
|
||||
--set PYTHONNOUSERSITE "true"
|
||||
)
|
||||
|
||||
if [ -z "$permitUserSite" ]; then
|
||||
wrap_args+=(--set PYTHONNOUSERSITE "true")
|
||||
fi
|
||||
|
||||
# Add any additional arguments provided by makeWrapperArgs
|
||||
# argument to buildPythonPackage.
|
||||
local -a user_args="($makeWrapperArgs)"
|
||||
|
@ -3,6 +3,7 @@
|
||||
, extraOutputsToInstall ? []
|
||||
, postBuild ? ""
|
||||
, ignoreCollisions ? false
|
||||
, permitUserSite ? false
|
||||
, requiredPythonModules
|
||||
# Wrap executables with the given argument.
|
||||
, makeWrapperArgs ? []
|
||||
@ -34,7 +35,7 @@ let
|
||||
if [ -f "$prg" ]; then
|
||||
rm -f "$out/bin/$prg"
|
||||
if [ -x "$prg" ]; then
|
||||
makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out" --set PYTHONNOUSERSITE "true" ${stdenv.lib.concatStringsSep " " makeWrapperArgs}
|
||||
makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out" ${if permitUserSite then "" else ''--set PYTHONNOUSERSITE "true"''} ${stdenv.lib.concatStringsSep " " makeWrapperArgs}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user