[Python-Dev] what to do if you don't want your module in Debian
David Cournapeau
cournape at gmail.com
Tue Apr 27 02:43:49 CEST 2010
On Tue, Apr 27, 2010 at 5:10 AM, Piotr Ożarowski <piotr at debian.org> wrote:
> if there's no other way (--install-data is ignored right now, and I know
> you're doing a great work to change that, thanks BTW), one could always
> use it in *one* place and later import the result in other parts of
> the code (instead of using __file__ again)
May I ask why this is not actually the solution to resources location
? For example, let's say we have (hypothetic version of distutils
supporting autoconf paths):
python setup.py install --prefix=/usr --datadir=/var/lib/foo
--manpath=/somefunkypath
Then the install step would generate a file __install_path.py such as:
PREFIX = "/usr"
DATADIR = "/var/lib/foo"
MANPATH = "/somfunkypath"
There remains then the problem of relocatable packages, but solving
this would be easy through a conditional in this generated file:
if RELOCATABLE:
PREFIX = "$prefix"
...
else:
and define $prefix and co from __file__ if necessary. All this would
be an implementation detail, so that the package developer effectively
do
from mypkg.file_paths import PREFIX, DATADIR, etc...
This is both simple and flexible: it is not mandatory, it does not
make life more complicated for python developers who don't care about
platform X. FWIW, that's the scheme I intend to support in my own
packaging solution,
cheers,
David
More information about the Python-Dev
mailing list