FHS, zopectl, #925, Re: [Zope-dev] 2.7 installation

Chris McDonough chrism@zope.com
20 Jun 2003 10:14:27 -0400


On Fri, 2003-06-20 at 01:38, Adrian van den Dries wrote:
> You may be interested in Kenneth Almquist's ash (aka dash in Debian):

Optimally the configure script will work in any bourne-shell-derived
shell (e.g. the bourne shell on Solaris).

> With the distutils, ``--home`` is version-agnostic (installs package
> ``foo`` into ``$HOME/lib/python/foo/``) and ``--prefix`` is
> version-aware (installs into ``$PREFIX/lib/pythonX.Y/site-packages``).

OK.  This option always seemed a little weird to me, but let's run with
it. ;-)

> ``inst/Makefile.in`` could probably be updated to do a --prefix install
> if $(PREFIX) is defined, else it defaults to a --home install.
> 
> (Mockups)
> 
>   # the next commands are all equivalent
>   # and produce the install target
>   # ``python setup.py --home=/usr/local/zope``
> 
>   python inst/configure.py --home=/usr/local/zope
>   ./configure --home=/usr/local/zope
>   ./configure

OK, looks good.

>   # the next command produces the install target
>   # ``python setup.py --prefix=/usr/local``
>   # which installs packages to /usr/local/lib/python2.2/site-packages
> 
>   python inst/configure.py --prefix=/usr/local

I like it because it's consistent with the distutils flags.

Where do ancillary files like those in bin, doc, and whatnot go when you
invoke this command?  /usr/local/bin and /usr/local/doc?

> (Couple of hours later).
> 
> OK, attached is a patch to inst/Makefile.in and inst/configure.py that
> distinguishes --home and --prefix parameters and passes them onto the
> distutils.  But for some reason, there is still no difference between
> --prefix and --home, even though it's passing those options to the
> distutils.  I suspect it might have something to do with this exerpt
> from setup.py::

Thanks for the work!  I also like the structured text style colons! ;-)
> 
>   # We create a custom "install scheme" that works the same way on all
>   # platforms.  We do this in order to prevent distutils from trying to
>   # guess where to put our files on a per-platform basis.
> 
>   ZOPE_INSTALL_SCHEME = {
>     'purelib': '$base/lib/python',
>     'platlib': '$base/lib/python',
>     'headers': '$base/lib/python',
>     'scripts': '$base/bin',
>     'data'   : '$base/lib/python',
>   }
> 
> That looks a little evil to me.

Evil?  That's a hundred dollar line of code right there!  ;-)

Convincing distutils to behave in a predictable way is hard.

Distutils works very differently on Windows and UNIX.  --home is not
supported on Windows and the default filepaths are different for a
prefix install between platforms.  I have also experienced differences
in distutils behavior between Python versions that make it difficult to
know exactly what's going to happen when you run "setup.py install".  I
don't remember the details, but it wasn't pretty.

The ZOPE_INSTALL_SCHEME was meant to gloss over the differences in OS
and Python version.  In this scheme, everything (data, scripts,
libraries) will always be installed into a single directory regardless
of your platform.

If we're no longer going to punt in this way, someone (probably me)
needs to do the work to ensure that we have all the options we need but
that it continues to work both under UNIX and Windows.  Your code is a
start, but obviously we'll need to do some work on setup.py.

Thanks!

- C