[Distutils] RFC: enhanced file list description for Distutils (PEP 376 extension)
Tarek Ziadé
ziade.tarek at gmail.com
Sat Mar 13 18:07:45 CET 2010
Hello,
We worked during the Pycon sprint on PEP 376. The goal was to finish
the section about the RECORD file syntax. This file contains the list
of installed files when a project is installed using distutils (and
distutils-based tools.)
For all the files that are supposed to land in the Python tree on the
system, like Python modules, it's pretty clear and simple. The fuzzy
part in distutils has always been about resource files (configuration
files, help files, etc.) that should land on specific locations on the
target system if we want to be FHS-compliant.
We ended up working on something bigger for that. We wanted to make it
easier for developer to describe what their projects contain, and
easier for OS packagers to place resources files of a project in the
proper location.
For instance, a ini-file in your Foo project, called foo.cfg, should
land in /etc/ under Debian. From a developer point of view, the
location of the file on the target system doesn't really matter as
long as he can reach it somehow in its code. People that want a
generic solution put that file in the source tree and use __file__ to
find the path. That is not really robust and doesn't work if the
source tree is in a zip file for instance. Setuptools provides an api
for that, but the resource cannot be relocated on the system by the
packagers.
We worked on a solution to make life easier for developers and
packagers. IOW, let the packager define the paths of the files on the
system, and provide an API for the developer to get the file back.
Proposal
------------
Here's the proposal :
1. A ``resources`` section in ``setup.cfg`` that maps resource files
to their categories (and optionally subdirectory prefixes within those
categories)
2. A ``sysconfig.cfg`` file at the system Python level that maps
categories to a position on the filesystem
3. A simple ``pkgutil.open()`` API to access resources from code
Please read the full detailed proposal here :
http://hg.python.org/distutils2/file/tip/docs/design/wiki.rst, and
comment ! :)
Calendar
------------
I am working on finishing some details at the end of the proposal, but
the document is already readable (the unfinished parts are after the
API section).
If we can manage to finish the discussion on this in the upcoming
weeks and get it accepted by Guido, we could include in 2.7 a
sysconfig.cfg file that is used by the existing sysconfig.py APIs
(right now it is using a python dict for the paths), and add APIs in
pkgutil.
If we finish this work too late, (which is most likely to be the case
because 2.7b1 is due in a few weeks), we will add these APIs in
distutils2 I guess, and see if we can add them in the next version of
3.x (or 2.8 ;) )
Regards,
Tarek
--
Tarek Ziadé | http://ziade.org
More information about the Distutils-SIG
mailing list