From c9d97c9cf345605210bc7ad166ec0b72de7d1bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org> Date: Thu, 28 Jun 2012 11:51:36 +0200 Subject: [PATCH] debian/debian_defaults config file is no longer read in debpython.version._config DEBPYTHON_SUPPORTED and DEBPYTHON_DEFAULT is used in tests instead --- debpython/version.py | 3 +-- tests/common.mk | 12 ++++++++++++ tests/t1/Makefile | 11 +++-------- tests/t2/Makefile | 10 ++-------- tests/t3/Makefile | 11 +++-------- tests/t4/Makefile | 10 ++-------- tests/t5/Makefile | 10 ++-------- tests/t6/Makefile | 10 ++-------- tests/t7/Makefile | 10 ++-------- 9 files changed, 29 insertions(+), 58 deletions(-) create mode 100644 tests/common.mk diff --git a/debpython/version.py b/debpython/version.py index 544d65d..e1ac9a8 100644 --- a/debpython/version.py +++ b/debpython/version.py @@ -41,8 +41,7 @@ _supported = environ.get('DEBPYTHON_SUPPORTED') _default = environ.get('DEBPYTHON_DEFAULT') if not _supported or not _default: _config = SafeConfigParser() - _config.read(['/usr/share/python/debian_defaults', - join(dirname(__file__), '..', 'debian', 'debian_defaults')]) + _config.read('/usr/share/python/debian_defaults') if not _default: _default = _config.get('DEFAULT', 'default-version')[6:] if not _supported: diff --git a/tests/common.mk b/tests/common.mk new file mode 100644 index 0000000..00cb726 --- /dev/null +++ b/tests/common.mk @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +export DEBPYTHON_DEFAULT ?= $(shell sed -rne 's,^default-version = python(.*),\1,p' ../../debian/debian_defaults) +export DEBPYTHON_SUPPORTED ?= $(shell sed -rne '/^supported-versions/{s/^supported-versions = (.*)/\1/g;s/python//g;s/,//g;p}' ../../debian/debian_defaults) + +all: run check + +run: clean + dpkg-buildpackage -b -us -uc + +clean-common: + ./debian/rules clean diff --git a/tests/t1/Makefile b/tests/t1/Makefile index f3e1403..b66038c 100644 --- a/tests/t1/Makefile +++ b/tests/t1/Makefile @@ -1,11 +1,7 @@ #!/usr/bin/make -f -all: run check - -DPY=$(shell PYTHONPATH=../../ python -c 'import debpython.version as v; print(v.vrepr(v.DEFAULT))') - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +DPY=$(DEBPYTHON_DEFAULT) check: grep -q "Depends: .*python-mako" debian/python-foo/DEBIAN/control @@ -15,6 +11,5 @@ check: [ `readlink debian/python-foo/usr/lib/python$(DPY)/dist-packages/foo/absolute_link_to_tmp` = /tmp ] [ `readlink debian/python-foo/usr/lib/python$(DPY)/dist-packages/foo/link_to_parent_dir` = .. ] -clean: - ./debian/rules clean +clean: clean-common rm -rf lib/Foo.egg-info diff --git a/tests/t2/Makefile b/tests/t2/Makefile index 3d0226a..f46ef1c 100644 --- a/tests/t2/Makefile +++ b/tests/t2/Makefile @@ -1,16 +1,10 @@ #!/usr/bin/make -f -all: run check - - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +clean: clean-common check: test -f debian/python-foo/usr/lib/python2.6/dist-packages/foo.py test -f debian/python-foo/usr/lib/python2.6/dist-packages/bar/bar.py grep -q pycompile debian/python-foo/DEBIAN/postinst grep -q pyclean debian/python-foo/DEBIAN/prerm - -clean: - ./debian/rules clean diff --git a/tests/t3/Makefile b/tests/t3/Makefile index 2a17279..21658b4 100644 --- a/tests/t3/Makefile +++ b/tests/t3/Makefile @@ -1,11 +1,7 @@ #!/usr/bin/make -f -all: run check - -DPY=$(shell PYTHONPATH=../../ python -c 'import debpython.version as v; print(v.vrepr(v.DEFAULT))') - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +DPY=$(DEBPYTHON_DEFAULT) check: grep -q "pycompile -p python-foo /usr/lib/python-foo -V $(DPY)"\ @@ -22,6 +18,5 @@ check: test ! -L debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/quux.so.0 test ! -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/quux.so.0.0.0 -clean: - ./debian/rules clean +clean: clean-common rm -rf lib/Foo.egg-info build diff --git a/tests/t4/Makefile b/tests/t4/Makefile index 20f4e97..d0ebcb6 100644 --- a/tests/t4/Makefile +++ b/tests/t4/Makefile @@ -1,10 +1,7 @@ #!/usr/bin/make -f -all: run check - - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +clean: clean-common check: grep -q python2.6 debian/foo/usr/share/foo/foo.py @@ -14,6 +11,3 @@ check: grep -q python2.4 debian/foo/usr/share/foo/baz.py test ! -x debian/foo/usr/share/foo/baz.py grep -q Depends:.*python2.4 debian/foo/DEBIAN/control && false || true - -clean: - ./debian/rules clean diff --git a/tests/t5/Makefile b/tests/t5/Makefile index cde0061..bac6562 100644 --- a/tests/t5/Makefile +++ b/tests/t5/Makefile @@ -1,10 +1,7 @@ #!/usr/bin/make -f -all: run check - - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +clean: clean-common check: # test dh_python2 @@ -29,6 +26,3 @@ check: do [ `ls debian/python-foo/usr/lib/python2.*/*-packages/$$i/__init__.py 2>/dev/null || true | wc -l` = 0 ];\ [ `ls debian/python-foo/usr/lib/python2.*/*-packages/$$i/__init__.pyc 2>/dev/null || true | wc -l` = 0 ];\ done - -clean: - ./debian/rules clean diff --git a/tests/t6/Makefile b/tests/t6/Makefile index b8f141e..48e3104 100644 --- a/tests/t6/Makefile +++ b/tests/t6/Makefile @@ -1,10 +1,7 @@ #!/usr/bin/make -f -all: run check - - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +clean: clean-common check: # python2.4 hardcoded via `dh_python2 -V 2.4` @@ -19,6 +16,3 @@ check: grep -q Depends:.*python2.6 debian/foo/DEBIAN/control grep -q '\-V 2.6 /usr/share/foo' debian/foo/usr/share/python/runtime.d/foo.rtupdate grep -q '/usr/share/foo \-V 2.6' debian/foo/DEBIAN/postinst - -clean: - ./debian/rules clean diff --git a/tests/t7/Makefile b/tests/t7/Makefile index a2b7fe8..2488496 100644 --- a/tests/t7/Makefile +++ b/tests/t7/Makefile @@ -1,10 +1,7 @@ #!/usr/bin/make -f -all: run check - - -run: clean - dpkg-buildpackage -b -us -uc +include ../common.mk +clean: clean-common check: # python2.4 hardcoded via `dh_python2 -shebang ...python2.4` @@ -19,6 +16,3 @@ check: # /local removed from shebang grep -q '#! /usr/bin/python' debian/foo/usr/share/foo/baz.py grep -q '#! /usr/bin/python2.6' debian/foo/usr/share/foo/foo.py - -clean: - ./debian/rules clean -- GitLab