[Distutils] Install time prefixes and data files
Tarek Ziadé
ziade.tarek at gmail.com
Thu Nov 12 12:25:08 CET 2009
On Wed, Nov 11, 2009 at 4:24 PM, Wolodja Wentland
<wentland at cl.uni-heidelberg.de> wrote:
[..]
> Proposal
> --------
>
> I propose three things:
>
> 1. Save installation prefixes for every installed distribution
> 2. Define standard infixes for typical data file classes
> 3. Implement an API that is able to query that information/retrieve data
> files
+1 to this three points.
>
> 1 and 3. Discussion
>
> The installation prefixes could for example be saved within a suitable
> file in .egg-info/ which would mandate changes to PEP 376. I could think
> of a PREFIX file and the following methods/attribute for e.g. the
> Distribution class
>
> * get_install_prefixes() -> returns a dictionary with all prefixes for
> this distribution
>
> * get_data_file(type, name) -> get data file of given type and name (see
> (see below)
I recall someone proposing to have such a PREFIX file, to keep all
installation prefixes.
I think that's a good enhancement, could you work on a diff on PEP 376 ?
>
> 2. Discussion
>
> The FHS differentiates between various classes of files and defines
> proper location for them. We could define platform dependent
> standard infixes for the following data file classes for distribution
> foo:
>
> * configuration etc
> * shared data usr/share/foo/
> * readme usr/share/foo/README README, TODO, ... could
> be automatically
> discovered
> * examples usr/share/foo/examples
> * documentation usr/share/foo/doc
> * man files usr/share/man
> * variable var/lib/foo
> * ...
>
> There should be a set of platform dependent prefixes for all classes we
> agree on *and* it should be possible to change/set their default values
> with, for example, environment variables or command line options.
It sounds good for unix like system. But I am curious to see the paths
under windows.
>
> I call them infixes and not prefixes here, because applications like
> virtualenv might want to define a different root for these files than
> the system default one.
>
> Tarek suggested to use this scheme like this:
>
> setup(
> ...
> data_files = [
> ('$configuration', ['data/my.conf', 'data/default.conf']),
> ('$examples', ['doc/examples/do_foo.sample']),
> ('/i/want/file/here', ['custom_placed_file']),
> ...
> ]
> )
>
> The placeholders will then be replaced with their current value at
> installation time and the locations written to .egg-info/PREFIX.
Yes, and that could be done alongside the installation prefixes. Can
you provide a full example of a PREFIX file ?
Tarek
More information about the Distutils-SIG
mailing list