Commit 492b09b0 authored by Charles Ferguson's avatar Charles Ferguson
Browse files

Try to fix the usage of sed with fish and the exported variables on OSX.

On OSX there are different limitations, such as not being able to have
empty sub-expressions in the regular expressions passed to sed.
Additionally, having a different version of local::lib installed which
understands fish, and generates the exports differently broke the
automated translater. Working with 'any version' is hard, but I think
we may be nearly there.
parent 25e127e3
...@@ -211,7 +211,7 @@ function install_requirements() { ...@@ -211,7 +211,7 @@ function install_requirements() {
# to complete. # to complete.
local still_sorting=true local still_sorting=true
local iterations=20 local iterations=20
while $still_sorting && [ "$iterations" -gt 0 ] ; do while $still_sorting && [ "$iterations" -gt 0 ] && [ "${#required_defs[@]}" != 0 ] ; do
still_sorting=false still_sorting=false
local -a new_required_defs local -a new_required_defs
new_required_defs=() new_required_defs=()
...@@ -343,7 +343,7 @@ sed -E "s/^#.*//; /^ *$/d;" "${tmpinput}" \ ...@@ -343,7 +343,7 @@ sed -E "s/^#.*//; /^ *$/d;" "${tmpinput}" \
# Ensure that our environment is set up properly # Ensure that our environment is set up properly
mkdir -p "${environment}" mkdir -p "${environment}"
eval "$(perl -f -M"local::lib=${environment}")" eval "$(SHELL=/bin/bash perl -f -M"local::lib=${environment}" 2> /dev/null)"
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "Failed to create local::lib environment" echo "Failed to create local::lib environment"
exit 1 exit 1
...@@ -554,12 +554,17 @@ function _perllib_setup ...@@ -554,12 +554,17 @@ function _perllib_setup
end end
if [ "$var" = 'PATH' ] if [ "$var" = 'PATH' ]
eval (sed -E '/^(export |)'$var'=/ ! d; eval (sed -E '/^(export )?'$var'=/ ! d;
s/^(export |)'$var'="(.*)"(;|)/set -gx "'$var'" \2/; s/export '$var';//g;
s/:/ /g' "$tmpfile") s/^(export )?'$var'="(.*)";?/set -gx "'$var'" \2/;
s/\${'$var':\+:\${'$var'}}/'":\$$var"'/;
s/:/ /g' "$tmpfile")
else else
eval (sed -E '/^(export |)'$var'=/ ! d; eval (sed -E '/^(export )?'$var'=/ ! d;
s/^(export |)'$var'="(.*)"(;|)/set -gx "$var" "\2"/;' "$tmpfile") s/export '$var';//g;
s/^(export )?'$var'="(.*)";?/set -gx "'$var'" "\2"/;
s/\${'$var':\+:\${'$var'}}/'":\$$var"'/;
s/:/ /g' "$tmpfile")
end end
end end
rm -f "$tmpfile" rm -f "$tmpfile"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment