Installing platform-independent resources outside the Python package (was: Specifying ‘--install-data’ for each binary package)
Ben Finney <ben+debian@benfinney.id.au> writes:
> In that case, I currently have no good solution. I had hoped to use
> some Python standard-library resource access function to find the
> files wherever they are installed.
I have hacked a work-around:
* 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 ‘debian/rules’ to explicitly install the resource
files to ‘debian/resources/’. Make sure these rules work for the
multiple binary packages and for multiple builds.
* Use ‘<packagename>.install’ to install the resource files for each
package to ‘usr/share/<packagename>/’.
* Use ‘<packagename>.links’ to make a symlink for each package to
‘usr/share/<packagename>/foofile’ at
‘usr/lib/python${PYTHON_VERSION}/dist-packages/${DISTRIBUTION_NAME}/foofile’.
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.
> Currently the upstream Python code uses ‘os.path.dirname(__file__)’
> and the like to discover the location of the data files. It thereby
> assumes that the package data is installed to the same location as the
> Python code.
I'm still open to a better solution, that allows a Python application to
find resource files in a FHS-compliant location specified at install time.
--
\ “From the moment I picked your book up until I laid it down I |
`\ was convulsed with laughter. Someday I intend reading it.” |
_o__) —Groucho Marx |
Ben Finney
Reply to: