aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorJack Nagel2013-01-19 20:45:57 -0600
committerJack Nagel2013-01-21 17:24:10 -0600
commit3270fd2cd94e6ca637bbae5f2acfc9c1824d76e2 (patch)
tree6bcf99f0ffd48e0563e74b0e67665a7df47c6a7d /Library/Homebrew/extend
parent05fedd5c98f687b6cf95935a06d4660821d2ad2b (diff)
downloadhomebrew-3270fd2cd94e6ca637bbae5f2acfc9c1824d76e2.tar.bz2
ENV.with_build_environment
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 095d05b70..6ac5a0db2 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -438,6 +438,14 @@ class << ENV
self['PATH'] = paths.unshift(*self['PATH'].split(":")).uniq.join(":")
end
+ def with_build_environment
+ old_env = to_hash
+ setup_build_environment
+ yield
+ ensure
+ replace(old_env)
+ end
+
def fortran
fc_flag_vars = %w{FCFLAGS FFLAGS}