[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

installation of scripts in the brave new Python world




Hello All:

As I was trying to implement the new Python policy, I noticed an effect which is not directly addressed in the policy. That is when a package contains modules and scripts, there have to be special precautions taken to make sure that the scripts are not installed with a first line of

	#!/usr/bin/pythonX.Y

instead of #!/usr/bin/python

The python-imaging package, which has been given as an example of using pycentral fixes this by using sed to correct all first lines in scripts. This is easily done because all the scripts have file names of the form *.py. If a script does not have this kind of filename, it is more difficult.

Here is another suggestion for accomplishing the same thing. The idea here is to just build and install the scripts a final time using he default python after the scripts have already been installed from the versioned python installs.



PYVERS=$(shell pyversions -vr)

build-python-all: $(PYVERS:%=build-python%)
	python setup.py build_scripts --build-dir=build/Scripts || exit 1;
	touch $@

build-python%:
	dh_testdir
	python$* setup.py build || exit 1 ;
	touch $@

install-python-all: $(PYVERS:%=install-python%)
	python setup.py install_scripts --force \
	 --install-dir=$(CURDIR)/debian/debian/python-foo/usr/bin \
	 --build-dir=build/Scripts || exit 1 ;

install-python%:
	python$* setup.py install \
	 --prefix=$(CURDIR)/debian/python-foo/usr || exit 1 ;
        -find $(CURDIR)/debian/ -name '*.py[co]' | xargs rm -f




Cheers,

Carlo

--
Carlo U. Segre -- Professor of Physics
Associate Dean for Special Projects, Graduate College
Illinois Institute of Technology
Voice: 312.567.3498            Fax: 312.567.3494
Carlo.Segre@iit.edu    http://www.iit.edu/~segre



Reply to: