Closed tonycpsu closed 10 years ago
Was this behaviour different before? Homebrew's mercurial is explicitly built against the system python; it's not meant to be used with extensions built against any other python.
Was this behaviour different before?
It was, but I seem to recall having to work around this same thing before, so I may have voided my warranty by doing so.
it's not meant to be used with extensions built against any other python.
OK, but if I try to use the system Python to install an extension (e.g. sudo /usr/bin/easy_install hgview
), I get:
ImportError: No module named mercurial
Which makes sense, considering the mercurial Python packages are installed under /usr/local/lib/...
This isn't what you want to hear, but Homebrew's mercurial formula is meant to install the CLI tool, and that's it. We ran into too many problems trying to make it work reliably for both use cases (if you search the issue tracker you will probably see dozens of previous issues). If you want to use it as a library you should install it with pip.
@jacknagel, I don't understand what you mean. I'm trying to use the command-line tool, but with some extensions. Is it the expected behavior that no mercurial extension will be usable with the Homebrew mercurial formula?
That wouldn't necessarily surprise me. If you ever try to add a depends_on "mercurial"
to any formula and brew audit
it it'll tell you Homebrew explicitly supports Mercurial installations outside of HB's sandbox.
It's possible, but inconvenient. Homebrew's mercurial is there for those who want to brew install mercurial
and be done, not so much for people who want to install extensions via pip, etc.
Sorry, I misunderstood the nature of the issue, but I'm not sure that the answer is any different.
Fair enough, folks. In case anyone ever tries to figure things out, a coworker of mine says she has no such problems with the Fink port of hg, so maybe someone could peek at what they're doing? I know Macports replaces the system python in /usr/bin
to the Macports version, so that's definitely a no-go, but maybe Fink handles the Python package path more gracefully? It's actually kind of hard to use a vanilla hg with no extensions these days, so I might have to look into adding Fink to my system just to get a fully-functional hg.
Anyway, I appreciate you all taking the time to explain the situation.
I might have to look into adding Fink to my system just to get a fully-functional hg.
Out of curiosity, is there something that makes the pip install
ed version of hg not work well?
Is Fink any better these days? The last time I used Fink it was a complete mess & a nightmare to deal with. I just tried glancing at the Fink Mercurial package, but it seems they don't publicly display the files involved? It'd be useful to see how they're implementing Mercurial as a reference.
Downloading the tarball for Mercurial & running make install
would install it into /usr/local/bin, so it'd be in the same place but outside of Homebrew. Is that not an option for you?
Nah, pip
works fine, but I've been trying to move as many things into Homebrew as I can to make keeping up with updates easier. But I guess pip
beats having to install an alternate package manager. Hopefully some day Homebrew and Python will play nicer, though that would probably have to come from the Python side.
And yeah, I've avoided Fink for the same reasons, but my very clueful coworker swears by it. shrug
Fink/MacPorts work similarly by not using the system Python and needing people install their Python whenever they want to do anything. Homebrew philosophy is that this is unnecessary but it comes with some limitations. You may have more luck with brew install mercurial --build-from-source
.
@tonycpsu Macports doesn't replace any system files. It provides its own in /opt/local/bin
.
After upgrading mercurial, I am unable to load extensions installed under /usr/local/lib/python2.7/site-packages -- I get errors like:
/usr/local/bin
is before/usr/bin
in my path, so I thought that hg would build against the homebrew version of Python, but if I runvi
which hg`, I see that the file begins with
#!/usr/bin/python. This would seem to explain why the extensions won't load, since sys.path is set based on the python interpreter that hg uses, but why would hg build this way? I tried
brew install --build-from-source hg` to avoid any issues with the bottled version, but had no luck with that.If I manually change the top of
/usr/local/bin/hg
to#!/usr/local/bin/python
it works, but I'd like to figure out what's wrong so I don't have to do this each time I upgrade hg.Here's my brew config/doctor output:
https://gist.github.com/tonycpsu/ae303478013b4eddb32b