The problem

Python modules using distutils and setuptools are known to make linux distributors unhappy, for various reasons. One of them is that distutils does not make possible to install softwares according to the FHS without a lot of effort. This document is only concerned with the requirements to fix this situation at a minimal cost for python developers.


Generally, a python packaged with distutils will be installed as follows:

       python install --prefix=$PREFIX

This will install the package in $PREFIX/lib/python-$PYVER/site-packages on Linux, plus scripts into $PREFIX/bin. The documentation, python source files (.py) and architecture dependent files (C extensions) are all installed in one directory, thus violating the FHS.


Many open source softwares are distributed using autoconf. The steps to install a package from sources are:

       ./configure --prefix=$PREFIX
       make install

The make install step will do something very similar to the distutils install command. The main difference is additional options available from the configure script for customization:

       --bindir=DIR           user executables [EPREFIX/bin]
       --sbindir=DIR          system admin executables [EPREFIX/sbin]
       --libexecdir=DIR       program executables [EPREFIX/libexec]
       --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
       --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
       --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
       --libdir=DIR           object code libraries [EPREFIX/lib]
       --includedir=DIR       C header files [PREFIX/include]
       --oldincludedir=DIR    C header files for non-gcc [/usr/include]
       --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
       --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
       --infodir=DIR          info documentation [DATAROOTDIR/info]
       --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
       --mandir=DIR           man documentation [DATAROOTDIR/man]
       --docdir=DIR           documentation root [DATAROOTDIR/doc/libsndfile]
       --htmldir=DIR          html documentation [DOCDIR]
       --dvidir=DIR           dvi documentation [DOCDIR]
       --pdfdir=DIR           pdf documentation [DOCDIR]
       --psdir=DIR            ps documentation [DOCDIR]

Each of this option can be set independently if desired - the autotools handle each category independently. This has several advantages:


The solution is easy, at least in principle. Instead of indistinctively installing everything at one location, distutils should be able to deal correctly with the following kind of options:

       python install --bindir=$BINDIR --sbindir=$SBINDIR

to install the software as desired. Note that distutils does NOT have to know how to install things as required as the FHS: distutils does not need to implement any policy. Some Linux distributions do not follow the FHS - and happily package autoconf-based packages as they want (example: gobolinux).


Here are categories which are necessary to build a Debian package:

TODO: others - include path, header path, var path for log, etc... Other distributions, OS ?

Distutils implementation

Obviously distutils should internally keep separate lists for each kind of files.

Other problems:

Distutils/Proposals/AutoconfLikeOptions (last edited 2009-01-31 16:07:09 by AkiraKitada)

Unable to edit the page? See the FrontPage for instructions.