From 0b50110107ea2998e65011ec31ce45931b446dab Mon Sep 17 00:00:00 2001 From: Samuel John Date: Mon, 21 Jan 2013 10:33:56 +0100 Subject: Python 2.x and 3.x support New `depends_on :python` Dependency. New `depends_on :python3` Dependency. To avoid having multiple formulae with endings -py2 and -py3, we will handle support for different pythons (2.x vs. 3.x) in the same formula. Further brewed vs. external python will be transparently supported. The formula also gets a new object `python`, which is false if no Python is available or the user has disabled it. Otherwise it is defined and provides several support methods: python.site_packages # the site-packages in the formula's Cellar python.global_site_packages python.binary # the full path to the python binary python.prefix python.version python.version.major python.version.minor python.xy # => e.g. "python2.7" python.incdir # includes of python python.libdir # the python dylib library python.pkg_config_path # used internally by brew python.from_osx? python.framework? python.universal? python.pypy? python.standard_caveats # Text to set PYTHONPATH for python.from_osx? python.if3then3 # => "" for 2.x and to "3" for 3.x. Further, to avoid code duplication, `python` takes an optional block that is run twice if the formula defines depends_on :python AND :python3. python do system python, 'setup.py', "--prefix=#{prefix}" end Read more in the Homebrew wiki. --- Library/Formula/macvim.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'Library/Formula/macvim.rb') diff --git a/Library/Formula/macvim.rb b/Library/Formula/macvim.rb index 2ab7ee02a..d10fa4d52 100644 --- a/Library/Formula/macvim.rb +++ b/Library/Formula/macvim.rb @@ -10,10 +10,11 @@ class Macvim < Formula option "custom-icons", "Try to generate custom document icons" option "override-system-vim", "Override system vim" - option "with-python3", "Build with Python 3 scripting support" depends_on 'cscope' => :recommended depends_on 'lua' => :optional + depends_on :python => :recommended + depends_on :python3 => :optional # Help us! :python3 is MacVim makes the window disappear! depends_on :xcode # For xcodebuild. @@ -30,14 +31,16 @@ class Macvim < Formula args = %W[ --with-features=huge - --with-tlib=ncurses --enable-multibyte --with-macarchs=#{arch} + --with-macsdk=10.8 --enable-perlinterp - --enable-pythoninterp --enable-rubyinterp --enable-tclinterp --with-ruby-command=#{RUBY_PATH} + --with-tlib=ncurses + --with-compiledby=Homebrew + --with-local-dir=#{HOMEBREW_PREFIX} ] args << "--enable-cscope" if build.with? "cscope" @@ -47,7 +50,17 @@ class Macvim < Formula args << "--with-lua-prefix=#{HOMEBREW_PREFIX}" end - args << "--enable-python3interp" if build.include? "with-python3" + args << "--enable-pythoninterp=dynamic" if build.with? 'python' + args << "--enable-python3interp=dynamic" if build.with? "python3" + + unless MacOS::CLT.installed? + # On Xcode-only systems: + # Macvim cannot deal with "/Applications/Xcode.app/Contents/Developer" as + # it is returned by `xcode-select -print-path` and already set by + # Homebrew (in superenv). Instead Macvim needs the deeper dir to directly + # append "SDKs/...". + args << "--with-developer-dir=#{MacOS::Xcode.prefix}/Platforms/MacOSX.platform/Developer/" + end system "./configure", *args -- cgit v1.2.3