aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel John2013-06-04 16:59:15 +0200
committerSamuel John2013-06-04 17:05:02 +0200
commitf1a4dad61fd706f95d3280dc0b2efade296f0bb5 (patch)
tree1914e8780317aae187a42b5d8607499e9d3aff0e
parent09d5f8abd69779d094df28fd4370315dac6b0817 (diff)
downloadhomebrew-f1a4dad61fd706f95d3280dc0b2efade296f0bb5.tar.bz2
mercurial: Install python bindings properly
Also allow to build with --HEAD by making brew's download strategy aware of a brewed but unlined hg. Adapted the caveats so that the procedure to brew hg --HEAD is clear. Mention how to config hgk in the caveats.
-rw-r--r--Library/Formula/mercurial.rb55
-rw-r--r--Library/Homebrew/download_strategy.rb1
2 files changed, 22 insertions, 34 deletions
diff --git a/Library/Formula/mercurial.rb b/Library/Formula/mercurial.rb
index 10d482970..2254d7233 100644
--- a/Library/Formula/mercurial.rb
+++ b/Library/Formula/mercurial.rb
@@ -10,63 +10,50 @@ class Mercurial < Formula
depends_on :python # its written in Python, so this is a hard dep
depends_on 'docutils' => :python if build.head? or build.include? 'doc'
- option 'doc', "Build the documentation"
-
def install
- # Don't add compiler specific flags so we can build against
- # System-provided Python.
- ENV.minimal_optimization
-
- # install the completion script
- bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash'
-
python do
+ # Inside this python do block, the PYTHONPATH (and more) is alreay set up
if python.from_osx? && !MacOS::CLT.installed?
# Help castrated system python on Xcode find the Python.h:
# Setting CFLAGS does not work :-(
inreplace 'setup.py', 'get_python_inc()', "'#{python.incdir}'"
end
- system "make doc" if build.head? or build.include? 'doc'
- system "make local"
-
- libexec.install 'hg', 'mercurial', 'hgext'
- # If we get it working with python3, we would need the next line instead:
- #['hg', 'mercurial', 'hgext'].each{ |f| libexec.install "#{f}#{python.if3then3}" }
- # Symlink the hg binary into bin
- bin.install_symlink libexec/"hg#{python.if3then3}"
+ # Man pages come pre-built in source releases
+ system "make doc" if build.head? or build.include? 'doc'
+ system "make", "PREFIX=#{prefix}", "install"
# Install some contribs
- bin.install "contrib/hgk#{python.if3then3}"
+ bin.install "contrib/hgk"
# Install man pages
man1.install 'doc/hg.1'
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
-
- system 'make clean'
end
+ # install the completion scripts
+ bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash'
+ zsh_completion.install 'contrib/zsh_completion' => '_hg'
end
def caveats
- s = ''
-
- s += <<-EOS.undent
- Extensions have been installed to:
- #{opt_prefix}/libexec/hgext
+ s = <<-EOS.undent
+ In order to use the graphical `hgk`, you may have to set:
+ export HG=hg
+ and add to your ~/.hgrc file:
+ [extensions]
+ hgk=
EOS
if build.head? then s += <<-EOS.undent
-
- Mercurial is required to fetch its own repository, so there are now two
- installations of mercurial on this machine. If the previous installation
- was done via Homebrew, the old version may need to be cleaned up and new
- version linked:
-
- brew cleanup mercurial && brew link mercurial
+ To install the --HEAD version of mercurial, you have to:
+ 1. `brew install mercurial` # so brew can use this to fetch sources!
+ 2. `brew unlink mercurial`
+ 3. `brew install mercurial --HEAD`
+ 4. `brew cleanup mercurial` # to remove the older non-HEAD version
EOS
end
-
- return s
+ s += python.standard_caveats if python
+ s
end
def test
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 72a0652fb..90fa724dc 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -552,6 +552,7 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
@path ||= %W[
#{which("hg")}
#{HOMEBREW_PREFIX}/bin/hg
+ #{Formula.factory('mercurial').opt_prefix}/bin/hg
#{HOMEBREW_PREFIX}/share/python/hg
].find { |p| File.executable? p }
end