Commit graph

13 commits

Author SHA1 Message Date
Jan Tojnar f4e74edd8c python.pkgs.wrapPython: get rid of warning
When `makeWrapperArgs` variable is not set, `declare -p makeWrapperArgs`
will return with 1 and print an error message to stderr.

I did not handle the non-existence case in b0633406cb
because I thought `mk-python-derivation` will always define `makeWrapperArgs`
but `wrapProgram` can be called independently. And even with `mk-python-derivation`,
`makeWrappers` will not be set unless explicitly declared in the derivation
because of https://github.com/NixOS/nix/issues/1461.

I was lead to believe that because the builds were succeeding and I confirmed
that the mechanism fails when the variable is not defined and `-o nounset` is enabled.
It appears that `wrapPython` setup hook is not running under `-o nounset`, though,
invaldating the assumption.

Now we are checking that the variable exists before checking its type, which
will get rid of the warning and also prevent future error when `-o nounset`
is enabled in the setup hook.

For more information, see the discussion at
https://github.com/NixOS/nixpkgs/commit/a6bb2ede232940a96150da7207a3ecd15eb6328
2019-12-30 16:46:55 +01:00
Jan Tojnar a6bb2ede23
python.pkgs.wrapPython: fix string makeWrapperArgs
Bash takes an assignment of a string to an array variable:

local -a user_args
user_args="(foo bar)"

to mean appending the string to the array, not parsing the string into
an array as is the case when on the same line as the declaration:

local -a user_args="(foo bar)"

b0633406cb extracted the declaration before
the newly branched code block, causing string makeWrapperArgs being added
to the array verbatim.

Since local is function scoped, it does not matter if we move it inside
each of the branches so we fix it this way.
2019-12-28 22:23:36 +01:00
worldofpeace 4a2621da53
Merge pull request #76283 from jtojnar/python-mwa
python.pkgs.wrapPython: fix makeWrapperArgs
2019-12-26 19:21:37 -05:00
Jan Tojnar b0633406cb
python.pkgs.wrapPython: fix makeWrapperArgs
When `makeWrapperArgs` is a Bash array, we only passed the first
item to `wrapProgram`. We need to use `"${makeWrapperArgs[@]}"`
to extract all the items. But that breaks the common string case so
we need to handle that case separately.
2019-12-23 18:02:44 +01:00
Tom McLaughlin a3f24daa7b Add flag to disable PYTHONNOUSERSITE for wrapped binaries in python environments 2019-05-13 02:56:56 -07:00
Tom McLaughlin 0045164b15 Add flag to disable PYTHONNOUSERSITE for wrapped python binaries 2019-05-13 02:56:32 -07:00
Frederik Rietdijk f665828fa3 Python: improve cross-compilation
This changeset allows for cross-compilation of Python packages. Packages
built with buildPythonPackage are not allowed to refer to the build
machine. Executables that have shebangs will refer to the host.
2019-01-04 10:45:22 +01:00
Jörg Thalheim 855777ad22 wrap-python: fix pypy site-packages path 2018-12-20 14:18:25 +00:00
John Ericson da19c34d0f stdenv setup: Always use both propagated files
This continues #23374, which always kept around both attributes, by
always including both propagated files: `propgated-native-build-inputs`
and `propagated-build-inputs`. `nativePkgs` and `crossPkgs` are still
defined as before, however, so this change should only barely
observable.

This is an incremental step to fully keeping the dependencies separate
in all cases.
2017-11-21 10:44:44 -05:00
Frederik Rietdijk 85a0ab4b23 Python: disable user site-packages for programs and environments.
Python by default checks a `site-packages` folder in the user's home
folder. We do not want such an impurity and therefore disable it.
Fixes #26846.
2017-07-31 13:16:29 +02:00
Frederik Rietdijk c10af9e744 Python: wrapPythonPrograms: only wrap in $out/bin
Thus far all executables in a derivation were wrapped. This commit
only wraps executables in $out/bin. If other scripts need to be wrapped
as well, then one can use wrapPythonProgramsIn.
2017-05-27 14:25:08 +02:00
Nikolay Amiantov 7cbe538e94 pythonPackages.wrapPython: fix for paths with spaces 2017-02-19 01:43:12 +03:00
Frederik Rietdijk b080748d42 Python: move python-modules/generic to interpreter folder 2016-09-01 16:16:31 +02:00
Renamed from pkgs/development/python-modules/generic/wrap.sh (Browse further)