Skip to content

Commit

Permalink
Merge pull request kivy#320 from kived/recipe-environment
Browse files Browse the repository at this point in the history
save and restore environment when running recipe functions
  • Loading branch information
kived committed Mar 17, 2015
2 parents 5a9d605 + 63e0dbc commit 9797fe6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,23 @@ function run_get_packages() {
done
}

function envfn() {
envsave=$(mktemp)
envrestore=$(mktemp)
set > $envsave
$1
set > $envrestore
eval $(grep -v -F -f$envrestore $envsave)
rm -f $envsave $envrestore
}

function run_prebuild() {
info "Run prebuild"
cd $BUILD_PATH
for module in $MODULES; do
fn=$(echo prebuild_$module)
debug "Call $fn"
$fn
envfn $fn
done
}

Expand Down Expand Up @@ -694,7 +704,7 @@ function run_build() {
if [ "X$DO_BUILD" == "X1" ] || [ ! -f "$MARKER_FN" ]; then
debug "Call $fn"
rm -f "$MARKER_FN"
$fn
envfn $fn
touch "$MARKER_FN"
else
debug "Skipped $fn"
Expand All @@ -708,7 +718,7 @@ function run_postbuild() {
for module in $MODULES; do
fn=$(echo postbuild_$module)
debug "Call $fn"
$fn
envfn $fn
done
}

Expand Down

0 comments on commit 9797fe6

Please sign in to comment.