[Python-Dev] what to do if you don't want your module in Debian
Tarek Ziadé
ziade.tarek at gmail.com
Tue Apr 27 00:22:30 CEST 2010
More information about the Python-Dev mailing list
Tue Apr 27 00:22:30 CEST 2010
- Previous message: [Python-Dev] what to do if you don't want your module in Debian
- Next message: [Python-Dev] what to do if you don't want your module in Debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Apr 26, 2010 at 11:56 PM, Robert Kern <robert.kern at gmail.com> wrote: [..] > > I don't think the OP is really speaking against using __file__ per se, but > rather putting data into the package however it is accessed. The > Linux-packager preferred practice is to install into the appropriate > /usr/shared/ subdirectory. Writing portable libraries (with portable > setup.py files!) is difficult to do that way, though. Well, the only portable way to read a resource file these days in Python is to put it in your project source tree so you know for sure you can access it the same way no matter what the platform is. Thus, using __file__. The key to fix this is to have a registered list of paths for each platform at Python level. Roughly summarized : the work we are doing will consist of defining variables that points to target paths for each platform (like /usr/shared in linux) at Python level, and let the developers define that a file is under a path defined by a variable (like "shared"). For example, a project will be able to read/write the "foo.txt" file using: pkgutil.open('shared', 'foo.txt') pkgutil will look in Python for the path corresponding to "shared" and expand it. The result will vary depending on the platform, and the os packagers will be able to change that path globally in Python or locally in the project.
- Previous message: [Python-Dev] what to do if you don't want your module in Debian
- Next message: [Python-Dev] what to do if you don't want your module in Debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list