Mercurial: revert to standalone install

This resolves issues with the hg binary being in the wrong place and
the docutils module being required to install.

Note that users who need mercurial installed as a Python module will
need to install it some other way.

Closes Homebrew/homebrew#20620.
master
Adam Vandenberg 2013-06-30 10:32:25 -07:00
parent 4fa70a6b8c
commit d78cce9ba7
1 changed files with 39 additions and 26 deletions

View File

@ -7,43 +7,56 @@ class Mercurial < Formula
head 'http://selenic.com/repo/hg', :using => :hg head 'http://selenic.com/repo/hg', :using => :hg
depends_on :python => 'docutils' depends_on 'docutils' => :python if build.head? or build.include? 'doc'
option 'doc', "Build the documentation"
def install def install
python do # Don't add compiler specific flags so we can build against
# Inside this python do block, the PYTHONPATH (and more) is alreay set up # System-provided Python.
if python.from_osx? && !MacOS::CLT.installed? ENV.minimal_optimization
# Help castrated system python on Xcode find the Python.h:
# Setting CFLAGS does not work :-(
inreplace 'setup.py', 'get_python_inc()', "'#{python.incdir}'"
end
# Man pages come pre-built in source releases
system "make doc"
system "make", "PREFIX=#{prefix}", "install"
# Install man pages
man1.install 'doc/hg.1'
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
end
# install the completion scripts
bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash' bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash'
zsh_completion.install 'contrib/zsh_completion' => '_hg'
system "make doc" if build.head? or build.include? 'doc'
system "make local"
libexec.install 'hg', 'mercurial', 'hgext'
# Symlink the hg binary into bin
bin.install_symlink libexec/'hg'
# Remove the hard-coded python invocation from hg
inreplace bin/'hg', %r[^#!.*$], '#!/usr/bin/env python'
# Install some contribs
bin.install 'contrib/hgk'
# Install man pages
man1.install 'doc/hg.1'
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
end end
def caveats def caveats
s = '' s = ''
s += <<-EOS.undent
Extensions have been installed to:
#{opt_prefix}/libexec/hgext
EOS
if build.head? then s += <<-EOS.undent if build.head? then s += <<-EOS.undent
To install the --HEAD version of mercurial, you have to:
1. `brew install mercurial` # so brew can use this to fetch sources! Mercurial is required to fetch its own repository, so there are now two
2. `brew unlink mercurial` installations of mercurial on this machine. If the previous installation
3. `brew install mercurial --HEAD` was done via Homebrew, the old version may need to be cleaned up and new
4. `brew cleanup mercurial` # to remove the older non-HEAD version version linked:
brew cleanup mercurial && brew link mercurial
EOS EOS
end end
s += python.standard_caveats if python
s return s
end end
def test def test