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)"

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