Installing resource data files and finding them
Ben Finney
ben+python at benfinney.id.au
Sun Sep 8 23:51:16 EDT 2013
Ben Finney <ben+python at benfinney.id.au> writes:
> I will need to change both the build configuration and the application
> code, so that instead it allows the resource files to be installed to
> an appropriate location on the target system, and seeks the data files
> in the correct location when run later.
I've used an ugly hack to work around this problem:
* Patch the ‘MANIFEST.in’ and ‘setup.py’ to omit all mention of the
resource files. This makes the Python Distutils simply omit the
resource files and not install them at all.
* Add a series of rules to the package builder to explicitly install the
resource files to a temporary build location. Make sure these rules
work for the multiple binary packages and for multiple builds.
* Install the resource files for each package to an FHS-compliant
location outside the Python package.
* Make a symlink within each installed package to the resource location
for the package.
That works for now. It's ugly and a maintenance burden, though: I would
hate to need to do this for resource files in every Python package.
> I had hoped to use Python's standard library (Distutils? Distribute?
> Something else?) to access the resources once installed to the correct
> location. This needs to allow the choice of location to be made at
> install-time, but discovered by the application at run-time.
Ideally I wouldn't need to subvert Distutils, but could somehow tell it
what I need and have it record the install-time decisions for the
run-time application's needs.
I'm still hoping there is a standard-library way to do this. Please let
me know.
--
\ “You are welcome to visit the cemetery where famous Russian and |
`\ Soviet composers, artists, and writers are buried daily except |
_o__) Thursday.” —Russian orthodox monastery, Moscow |
Ben Finney
More information about the Python-list
mailing list