aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorJack Nagel2013-08-19 12:32:59 -0500
committerJack Nagel2013-08-19 12:32:59 -0500
commita1ce0dba1233f756a96abf15185dbccffe88ad3b (patch)
tree254ec95aba41d566f8b2e63cc164c572027c910a /Library/Homebrew/extend
parentc0f5d3aa014ee075d063f8c24f8e98ad722a33ce (diff)
downloadhomebrew-a1ce0dba1233f756a96abf15185dbccffe88ad3b.tar.bz2
More robust implementation of ENV.with_build_environment
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV.rb11
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb8
2 files changed, 11 insertions, 8 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 52404a1c8..7ae8ecc0d 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -18,6 +18,17 @@ module EnvActivation
extend(Stdenv)
end
end
+
+ def with_build_environment
+ old_env = to_hash.dup
+ tmp_env = to_hash.dup.extend(EnvActivation)
+ tmp_env.activate_extensions!
+ tmp_env.setup_build_environment
+ replace(tmp_env)
+ yield
+ ensure
+ replace(old_env)
+ end
end
ENV.extend(EnvActivation)
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index b8d17b2c3..0b5fee954 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -70,14 +70,6 @@ module SharedEnvExtension
prepend 'PATH', HOMEBREW_PREFIX/'bin', ':'
end
- def with_build_environment
- old_env = to_hash
- setup_build_environment
- yield
- ensure
- replace(old_env)
- end
-
def fortran
# superenv removes these PATHs, but this option needs them
# TODO fix better, probably by making a super-fc