Add flag to disable PYTHONNOUSERSITE for wrapped python binaries

This commit is contained in:
Tom McLaughlin
2018-11-21 23:20:38 -07:00
parent 91047d75e1
commit 0045164b15
2 changed files with 8 additions and 1 deletions

View File

@@ -46,6 +46,9 @@
# Skip wrapping of python programs altogether
, dontWrapPythonPrograms ? false
# Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs
, skipNoUserSite ? 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.
@@ -93,6 +96,7 @@ let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attr
installCheckInputs = checkInputs;
postFixup = lib.optionalString (!dontWrapPythonPrograms) ''
${if skipNoUserSite then "export SKIPNOUSERSITE=1" else ""}
wrapPythonPrograms
'' + lib.optionalString removeBinBytecode ''
if [ -d "$out/bin" ]; then