[Python-modules-commits] r21075 - in packages/pytest/trunk/debian (py.test.sh rules)

laarmen-guest at users.alioth.debian.org laarmen-guest at users.alioth.debian.org
Fri Apr 6 12:57:48 UTC 2012


    Date: Friday, April 6, 2012 @ 12:57:41
  Author: laarmen-guest
Revision: 21075

Use a wrapper script for the non-default python versions

Added:
  packages/pytest/trunk/debian/py.test.sh
Modified:
  packages/pytest/trunk/debian/rules

Added: packages/pytest/trunk/debian/py.test.sh
===================================================================
--- packages/pytest/trunk/debian/py.test.sh	                        (rev 0)
+++ packages/pytest/trunk/debian/py.test.sh	2012-04-06 12:57:41 UTC (rev 21075)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+PYVERSION=`cut $0 -d '-' -f 2`
+UPSTREAMVERSION=#PYTEST#
+
+if [ -f /usr/bin/python$PYVERSION ] ; then
+
+    exec python$PYVERSION -c "import sys ; from pkg_resources import load_entry_point ; sys.argv[0]='/usr/bin/$0' ; sys.exit(load_entry_point('pytest==$UPSTREAMVERSION', 'console_scripts', 'py.test')())" $@
+
+else
+	echo "Please install the python$PYVERSION package." >&2
+    exit 1
+fi

Modified: packages/pytest/trunk/debian/rules
===================================================================
--- packages/pytest/trunk/debian/rules	2012-04-06 10:48:13 UTC (rev 21074)
+++ packages/pytest/trunk/debian/rules	2012-04-06 12:57:41 UTC (rev 21075)
@@ -4,12 +4,14 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-PYVERS :=  $(shell pyversions -r)
-PY3VERS := $(shell py3versions -r)
+PYVERS :=  $(shell pyversions -vr)
+PY3VERS := $(shell py3versions -vr)
 
 PYDEFAULT :=  $(shell pyversions -vd)
 PY3DEFAULT :=  $(shell py3versions -vd)
 
+UPSTREAM = $(shell dpkg-parsechangelog | grep Version | sed 's/Version: \(.*\)-.*/\1/' )
+
 %:
 	dh $@ --with python2,python3
 
@@ -17,7 +19,7 @@
 	# Build for all versions.
 	set -ex; \
 	for py in $(PYVERS) $(PY3VERS); do \
-		$$py setup.py build; \
+		python$$py setup.py build; \
 	done
 	PYTHONPATH=`pwd` make -C doc/ man
 	cp doc/_build/man/pytest.1 debian/py.test.1
@@ -32,11 +34,38 @@
 									    --root debian/python-pytest \
 										--install-layout=deb
 	rm debian/python-pytest/usr/bin/py.test-$(PYDEFAULT)
-	python$(PY3DEFAULT) setup.py install --skip-build --no-compile \
+	install -m 755 debian/py.test.sh debian/python-pytest/usr/bin/py.test-$(PYDEFAULT)
+	sed -i 's/#PYTEST#/$(UPSTREAM)/' debian/python-pytest/usr/bin/py.test-$(PYDEFAULT)
+	set -e; \
+	for py in $(PYVERS) ; do \
+		if [ "$$py" != "$(PYDEFAULT)" ] ; then \
+			dh_link -ppython-pytest usr/bin/py.test-$(PYDEFAULT) usr/bin/py.test-$$py; \
+		fi; \
+		dh_link -ppython-pytest /usr/share/man/man1/py.test.1.gz /usr/share/man/man1/py.test-$$py.1.gz ;\
+	done
+	set -e; \
+	for py in $(PY3VERS) ; do \
+		if [ "$$py" != "$(PY3DEFAULT)" ] ; then \
+			python$$py setup.py install --skip-build --no-compile \
 									    --root debian/python3-pytest \
-										--install-layout=deb
-	rm debian/python3-pytest/usr/bin/py.test-$(PY3DEFAULT)
+										--install-layout=deb \
+										--install-scripts=debian/tmp; \
+		else \
+			python$$py setup.py install --skip-build --no-compile \
+									    --root debian/python3-pytest \
+										--install-layout=deb; \
+		fi; \
+	done
 	mv debian/python3-pytest/usr/bin/py.test debian/python3-pytest/usr/bin/py.test-3
+	install -m 755 debian/py.test.sh debian/python3-pytest/usr/bin/py.test-$(PY3DEFAULT)
+	sed -i 's/#PYTEST#/$(UPSTREAM)/' debian/python3-pytest/usr/bin/py.test-$(PY3DEFAULT)
+	set -e; \
+	for py in $(PY3VERS) ; do \
+		if [ "$$py" != "$(PY3DEFAULT)" ] ; then \
+			dh_link -ppython3-pytest usr/bin/py.test-$(PY3DEFAULT) usr/bin/py.test-$$py; \
+		fi; \
+		dh_link -ppython3-pytest /usr/share/man/man1/py.test-3.1.gz /usr/share/man/man1/py.test-$$py.1.gz ;\
+	done
 	dh_install
 
 override_dh_auto_clean:
@@ -52,7 +81,7 @@
 #ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 #	set -ex; \
 #	for py in $(PYVERS) $(PY3VERS); do \
-#		$$py -m pytest testing ; \
+#		python$$py -m pytest testing ; \
 #	done
 #endif
 




More information about the Python-modules-commits mailing list