[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tool support for private modules



Le lundi 01 octobre 2007 à 18:37 +1000, Ben Finney a écrit :
> > That would work if the files were shipped
> > in /usr/lib/python2.X/site-packages.
> 
> That's where the distutils and setuptools place them by default,
> yes. I don't know what magic is required to put them elsewhere; that
> may be part of the answer, if someone can instruct me on how to do it.
> 
> The trouble is, these are modules that clearly fall under the "private
> modules for the program" description in the policy document. I fully
> agree with the policy that modules intended for internal use by a
> discrete set of programs should not be installed to the public
> site-packages directory.

As long as they are using their own namespace without a too generic
name, it's not *that* bad. It is not as if no other package was doing
such things.

> How can I use the tools available — distutils, setuptools, debhelper —
> to install these package-specific modules to a package-specific
> location, such that all the programs in the package will be able to
> find them?

The easiest way, if the modules are relocatable (99% of them are) is to
simply move them after installation.

Otherwise, you can pass specific arguments to setup.py. That would be,
python setup.py install --home=/usr/share/$package --install-purelib=.

More information: http://www.python.org/doc/2.4/inst/search-path.html

> > If, as the location suggests, they are public
> 
> The location does indeed suggest that, but AFAICT that's only because
> both distutils and setuptools makes no distinction between "modules
> intended for general use on the system" and "modules only intended for
> use by specific programs".

Well, in fact they do, but upstream developers generally simply ship
public modules.

> > If the modules are indeed private, it looks like you need to change
> > the path by hand, and to add it with sys.path.append("/the/path") at
> > the beginning of the binary.
> 
> Hmm. I am hoping that "modify the programs" is not a necessary part of
> this.

If upstream hasn't thought of it, it is. You only need to add one line
in the program, before the module is imported.

Cheers,
-- 
 .''`.           Josselin Mouette        /\./\
: :' :           josselin.mouette@ens-lyon.org
`. `'                        joss@debian.org
  `-  Debian GNU/Linux -- The power of freedom

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


Reply to: