Merge pull request #7936 from thinkpad20/set_arbitrary_env_variables_python
Add makeWrapperArgs argument to buildPythonPackage
This commit is contained in:
commit
0f6f4004f3
@ -420,6 +420,20 @@ twisted = buildPythonPackage {
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>makeWrapperArgs</varname></term>
|
||||
<listitem><para>
|
||||
A list of strings. Arguments to be passed to
|
||||
<varname>makeWrapper</varname>, which wraps generated binaries. By
|
||||
default, the arguments to <varname>makeWrapper</varname> set
|
||||
<varname>PATH</varname> and <varname>PYTHONPATH</varname> environment
|
||||
variables before calling the binary. Additional arguments here can
|
||||
allow a developer to set environment variables which will be
|
||||
available when the binary is run. For example,
|
||||
<varname>makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]</varname>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</section>
|
||||
|
@ -47,11 +47,19 @@
|
||||
# Execute after shell hook
|
||||
, postShellHook ? ""
|
||||
|
||||
# Additional arguments to pass to the makeWrapper function, which wraps
|
||||
# generated binaries.
|
||||
, makeWrapperArgs ? []
|
||||
|
||||
, ... } @ attrs:
|
||||
|
||||
|
||||
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
||||
if disabled then throw "${name} not supported for interpreter ${python.executable}" else python.stdenv.mkDerivation (attrs // {
|
||||
if disabled
|
||||
then throw "${name} not supported for interpreter ${python.executable}"
|
||||
else
|
||||
|
||||
python.stdenv.mkDerivation (attrs // {
|
||||
inherit doCheck;
|
||||
|
||||
name = namePrefix + name;
|
||||
|
@ -41,9 +41,16 @@ wrapPythonProgramsIn() {
|
||||
# wrapProgram creates the executable shell script described
|
||||
# above. The script will set PYTHONPATH and PATH variables.!
|
||||
# (see pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
wrapProgram $f \
|
||||
--prefix PYTHONPATH ':' $program_PYTHONPATH \
|
||||
--prefix PATH ':' $program_PATH
|
||||
local wrap_args="$f \
|
||||
--prefix PYTHONPATH ':' $program_PYTHONPATH \
|
||||
--prefix PATH ':' $program_PATH"
|
||||
|
||||
# Add any additional arguments provided by makeWrapperArgs
|
||||
# argument to buildPythonPackage.
|
||||
for arg in $makeWrapperArgs; do
|
||||
wrap_args="$wrap_args $arg"
|
||||
done
|
||||
wrapProgram $wrap_args
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user