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
|
# Skip wrapping of python programs altogether
|
||||||
, dontWrapPythonPrograms ? false
|
, dontWrapPythonPrograms ? false
|
||||||
|
|
||||||
|
# Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs
|
||||||
|
, permitUserSite ? false
|
||||||
|
|
||||||
# Remove bytecode from bin folder.
|
# Remove bytecode from bin folder.
|
||||||
# When a Python script has the extension `.py`, bytecode is generated
|
# When a Python script has the extension `.py`, bytecode is generated
|
||||||
# Typically, executables in bin have no extension, so no 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)
|
# (see pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||||
local -a wrap_args=("$f"
|
local -a wrap_args=("$f"
|
||||||
--prefix PATH ':' "$program_PATH"
|
--prefix PATH ':' "$program_PATH"
|
||||||
--set PYTHONNOUSERSITE "true"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [ -z "$permitUserSite" ]; then
|
||||||
|
wrap_args+=(--set PYTHONNOUSERSITE "true")
|
||||||
|
fi
|
||||||
|
|
||||||
# Add any additional arguments provided by makeWrapperArgs
|
# Add any additional arguments provided by makeWrapperArgs
|
||||||
# argument to buildPythonPackage.
|
# argument to buildPythonPackage.
|
||||||
local -a user_args="($makeWrapperArgs)"
|
local -a user_args="($makeWrapperArgs)"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
, extraOutputsToInstall ? []
|
, extraOutputsToInstall ? []
|
||||||
, postBuild ? ""
|
, postBuild ? ""
|
||||||
, ignoreCollisions ? false
|
, ignoreCollisions ? false
|
||||||
|
, permitUserSite ? false
|
||||||
, requiredPythonModules
|
, requiredPythonModules
|
||||||
# Wrap executables with the given argument.
|
# Wrap executables with the given argument.
|
||||||
, makeWrapperArgs ? []
|
, makeWrapperArgs ? []
|
||||||
|
@ -34,7 +35,7 @@ let
|
||||||
if [ -f "$prg" ]; then
|
if [ -f "$prg" ]; then
|
||||||
rm -f "$out/bin/$prg"
|
rm -f "$out/bin/$prg"
|
||||||
if [ -x "$prg" ]; then
|
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
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue