[PATCH] Makefile: add install-mac for framework-based Python installations (issue1412)

Matt Mackall mpm at selenic.com
Tue Jan 6 12:26:20 CST 2009

On Mon, 2009-01-05 at 03:08 -0500, Brodie Rao wrote:
> On Jan 5, 2009, at 12:45 AM, Matt Mackall wrote:
> > On Sun, 2009-01-04 at 19:16 -0500, Brodie Rao wrote:
> >> # HG changeset patch
> >> # User Brodie Rao <me+hg at dackz.net>
> >> # Date 1231029019 18000
> >> # Node ID 08023510ff113657ef96eb0ef32b86f661062899
> >> # Parent  49355875c8054259ffcf4bc913a8d97ff89330b1
> >> Makefile: add install-mac for framework-based Python installations  
> >> (issue1412)
> >>
> >> Apple's distributions and python.org's binary distributions of  
> >> Python are
> >> installed as self-contained frameworks. In this case site-packages  
> >> doesn't
> >> live under /usr/local, and --prefix is already properly configured  
> >> by the
> >> Python installation.
> >
> > If you think site-packages normally live under /usr/local/ on, say,
> > Linux, you have incompletely understood the problem. There's nothing
> > special about OS X here.
> >
> > The point here is to *not* install packages by default into filesystem
> > spaces controlled and owned by the system software, package managers  
> > or
> > installers so as to not interfere with those tools. This lets people
> > have a clear separation between "managed" (automatically installed and
> > upgraded) and "unmanaged" (hand-installed and upgraded).
> >
> > The bottom line is if you're installing a package from source, you're
> > expected to know where things belong on your particular operating
> > system.
> >
> > -- 
> > Mathematics is the supreme nostalgia of our time.
> >
> If --prefix is removed for installation on OS X, scripts correctly go  
> into /usr/local/bin and packages into /Library/Python/2.5/site- 
> packages, which is the designated place for site-specific packages  
> under OS X. This is the designated place for unmanaged packages, as  
> opposed to /System/Library/Frameworks/Python.framework/Versions/2.5/ 
> lib/python2.5/site-packages for system-managed packages.
> If --prefix is left in, Mercurial is installed into /usr/local/ 
> python2.5/site-packages. Running hg results in an ImportError because  
> this folder isn't used by Apple's distribution of Python, effectively  
> leaving hg in an unusable state.

Unusable is a bit of an exaggeration:

$ export PYTHONPATH=/usr/local...
$ hg

This used to be documented in the README and is now documented in
UnixInstall on the wiki. A sensible Python install adds the
appropriate /usr/local path to Python's site startup file for you.

> The point is that --prefix must be omitted for OS X, as it's already  
> properly configured to install into the unmanaged package area, and  
> inserting it makes it impossible to install Mercurial correctly using  
> the Makefile.

Impossible is also a bit of an exaggeration. Even if you can't afford an
editor, you can always do:

$ make PREFIX= # not recommended as it will make a mess of your system

Again, none of this is Mac-specific, so adding an install-mac is a step
in the wrong direction. Python wants to install stuff in bogus places by
default on various Linux distros too! Just because Python has yet to
gain any sense about package management doesn't make it the right thing
to do. Nothing but the operating system should be sticking stuff
in /usr/.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list