From 4032bc05e23d966cf96f1762a9001be3b73396b7 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Thu, 13 Feb 2014 15:48:19 -0800 Subject: [PATCH] python: Factor out lib_cellar Closes Homebrew/homebrew#26705. Signed-off-by: Adam Vandenberg --- Formula/python.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Formula/python.rb b/Formula/python.rb index eae24a19f3..c2b3bef3f0 100644 --- a/Formula/python.rb +++ b/Formula/python.rb @@ -40,8 +40,12 @@ class Python < Formula DATA if build.with? 'brewed-tk' end + def lib_cellar + prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7" + end + def site_packages_cellar - prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages" + lib_cellar/"site-packages" end # The HOMEBREW_PREFIX location of site-packages. @@ -139,7 +143,7 @@ class Python < Formula resource('pip').stage { system "#{bin}/python", *setup_args } # And now we write the distutils.cfg - cfg = prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/distutils.cfg" + cfg = lib_cellar/"distutils/distutils.cfg" cfg.delete if cfg.exist? cfg.write <<-EOF.undent [global] @@ -150,7 +154,7 @@ class Python < Formula EOF # Work-around for that bug: http://bugs.python.org/issue18050 - inreplace "#{prefix}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", 'import sys', <<-EOS.undent + inreplace lib_cellar/"re.py", "import sys", <<-EOS.undent import sys try: from _sre import MAXREPEAT @@ -162,7 +166,7 @@ class Python < Formula # Fixes setting Python build flags for certain software # See: https://github.com/Homebrew/homebrew/pull/20182 # http://bugs.python.org/issue3588 - inreplace "#{prefix}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile" do |s| + inreplace lib_cellar/"config/Makefile" do |s| s.change_make_var! "LINKFORSHARED", "-u _PyMac_Error $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)" end