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.
This commit is contained in:
Jan Tojnar 2019-12-28 22:10:28 +01:00
parent 4a2621da53
commit a6bb2ede23
No known key found for this signature in database
GPG key ID: 7FAB2A15F7A607A4

View file

@ -81,14 +81,13 @@ wrapPythonProgramsIn() {
# Add any additional arguments provided by makeWrapperArgs
# argument to buildPythonPackage.
local -a user_args
# We need to support both the case when makeWrapperArgs
# is an array and a IFS-separated string.
# TODO: remove the string branch when __structuredAttrs are used.
if [[ "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then
user_args=("${makeWrapperArgs[@]}")
local -a user_args=("${makeWrapperArgs[@]}")
else
user_args="($makeWrapperArgs)"
local -a user_args="($makeWrapperArgs)"
fi
local -a wrapProgramArgs=("${wrap_args[@]}" "${user_args[@]}")