Specifying ‘--install-data’ for each binary package
Howdy all, Howd can I write ‘debian/rules’ to specify the right ‘--install-data=’ value to ‘setup.py’ for each binary package? I'm working on modifying an existing Python package (‘python-coverage’) to install its arch-independent files to ‘/usr/share/${PACKAGE_NAME}/’. Those files are specifically declared in the ‘setup.py’ call via the ‘package_data’ option. To tell Distutils where those files go, http://docs.python.org/2/install/index.html#custom-installation> says the correct command-line option I should use is ‘--install-data=usr/share/${PACKAGE_NAME}’. So I'm currently crafting a ‘install-python%’ target to supply the appropriate option to each ‘python$* setup.py install …’: = PYTHON2_PACKAGE_NAME = python-coverage PYTHON3_PACKAGE_NAME = python3-coverage PYTHON2 = $(shell pyversions -vr) PYTHON3 = $(shell py3versions -vr) […] .PHONY: install-python% install-python%: PACKAGE_NAME=$(if $(findstr ${PYTHON3},%),${PYTHON3_PACKAGE_NAME},${PYTHON2_PACKAGE_NAME}) install-python%: python$* setup.py install --install-layout=deb \ --install-data=debian/${PACKAGE_NAME}/usr/share/${PACKAGE_NAME} \ --root=$(CURDIR)/debian/tmp […] .PHONY: override_dh_auto_install override_dh_auto_install: $(PYTHON2:%=install-python%) $(PYTHON3:%=install-python%) override_dh_auto_install: dh_auto_install = But that seems a baroque way of untangling the correct ‘debian/${PACKAGE_NAME}/usr/share/${PACKAGE_NAME}’ value, and it's not working for me anyway. Before I spend more time on this method, am I missing some Debhelper option that can do the right thing for ‘--install-data’? Or some other Debian practice that makes it easy to handle arch-independent files for Python? -- \ “It seems intuitively obvious to me, which means that it might | `\ be wrong.” —Chris Torek | _o__) | Ben Finney -- To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/7w8uzfqrhn@benfinney.id.au
Re: Specifying ‘--install-data’ for each binary package
[Ben Finney, 2013-09-02] > PYTHON2_PACKAGE_NAME = python-coverage > PYTHON3_PACKAGE_NAME = python3-coverage > PYTHON2 = $(shell pyversions -vr) > PYTHON3 = $(shell py3versions -vr) > […] > > .PHONY: install-python% > install-python%: PACKAGE_NAME=$(if $(findstr > ${PYTHON3},%),${PYTHON3_PACKAGE_NAME},${PYTHON2_PACKAGE_NAME}) > install-python%: > python$* setup.py install --install-layout=deb \ > --install-data=debian/${PACKAGE_NAME}/usr/share/${PACKAGE_NAME} \ --install-data=/usr/share/${PACKAGE_NAME} \ > --root=$(CURDIR)/debian/tmp --root=$(CURDIR)/debian/${PACKAGE_NAME} > Before I spend more time on this method, am I missing some Debhelper > option that can do the right thing for ‘--install-data’? Or some other > Debian practice that makes it easy to handle arch-independent files for > Python? | #! /usr/bin/make -f | export PYBUILD_NAME=coverage | export PYBUILD_INSTALL_ARGS=--install-data=/usr/share/{package}/ | %: | dh $@ --with python2,python3 --buildsystem=pybuild the only problem is... you need to wait for next dh-python release. I introduced Interpreter.suggest_pkg_name method (which generates what you want) in yesterday's upload, but I use it only to guess DESTDIR, it's not exposed yet. -- Piotr Ożarowski Debian GNU/Linux Developer www.ozarowski.pl www.griffith.cc www.debian.org GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645 -- To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20130902145213.gf24...@p1otr.com
Re: Specifying ‘--install-data’ for each binary package
[Piotr Ożarowski, 2013-09-02] > | #! /usr/bin/make -f > | export PYBUILD_NAME=coverage > | export PYBUILD_INSTALL_ARGS=--install-data=/usr/share/{package}/ > | %: > | dh $@ --with python2,python3 --buildsystem=pybuild > > the only problem is... you need to wait for next dh-python release. ok, ok, 1.20130902-1 released :) -- Piotr Ożarowski Debian GNU/Linux Developer www.ozarowski.pl www.griffith.cc www.debian.org GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645 signature.asc Description: Digital signature
Re: Specifying ‘--install-data’ for each binary package
Hello, Le 02/09/2013 09:32, Ben Finney a écrit : > Those files are specifically declared in the ‘setup.py’ call via the > ‘package_data’ option. To tell Distutils where those files go, > http://docs.python.org/2/install/index.html#custom-installation> > says the correct command-line option I should use is > ‘--install-data=usr/share/${PACKAGE_NAME}’. Are you sure? package_data files are installed alongside the Python modules; I think --data-files only controls the files declared as data_files. http://docs.python.org/2/distutils/setupscript#installing-package-data vs. http://docs.python.org/2/distutils/setupscript#installing-additional-files Regards -- To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/5224c69c.2020...@netwok.org
Re: Specifying ‘--install-data’ for each binary package
Éric Araujo writes: > Are you sure? package_data files are installed alongside the Python > modules; I think --data-files only controls the files declared as > data_files. 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. But my understanding is that, unlike ‘package_data’, the ‘data_files’ option causes files to be installed to a location that is not discoverable by the resulting library using Python's resource-access functions. Is that right? 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've reported Bug#721676 for the problem in this particular package. I will need to patch the upstream code, so that instead it seeks the data files in the correct location. I had hoped to use Python's standard library (Distutils? Distribute? Something else?) to access the resources once installed to the correct location. Is there a way to do that, or is this a problem still unsolved in Python? -- \ “It ain't so much the things we don't know that get us in | `\trouble. It's the things we know that ain't so.” —Artemus Ward | _o__) (1834–1867), U.S. journalist | Ben Finney -- To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/7wppsqaepu@benfinney.id.au