diff --git a/debpython/version.py b/debpython/version.py index 544d65ddd40f7419bd4a66e8fa558e84da6ba047..e1ac9a848aed874e8109b7940cbf4105fff0a984 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 0000000000000000000000000000000000000000..00cb7261c888f32eccef1e72d235bda309b1817c --- /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 f3e1403d88e959253945dc55226c642ce1f2e90d..b66038c95a519b5828e1521cf4c7f9608abdc3f1 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 3d0226a8773d3eb6a5d0bb545b8beb91495a0048..f46ef1cc79650e3a57b6c61797800250440196ca 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 2a1727900df4d934167f26344088b230aec4dd9f..21658b4736062f4459c2e898224a9ed3aedcf5c7 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 20f4e97b2c4cb8c46956f3ee2cc835ae3c128185..d0ebcb65748b73aeac18492fead38aa1a70249bf 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 cde00619bc32154e238c89efbdc4d18231e9471c..bac656222f6d902cfc5236e08c91e8ba0bb01171 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 b8f141e9b6eb43282493697d3ba5bea13c961b24..48e3104382883cf621f9ff5a9d7721bfa7e3b118 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 a2b7fe8a011ec5351a11045bf09a7cebe4c121f6..2488496549d160aa9f792e37c97acbfb5bc4c1b9 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