diff --git a/debian/changelog b/debian/changelog index da993ac36997d992b2a35dcb293dc628fe63f802..13f9fc1809076a6773c61d2f6c116d3e2474f73e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,18 +1,21 @@ python-defaults (2.6.6-6) UNRELEASED; urgency=low - * Make the error message about missing extension more clear - (and more verbose in --verbose mode) - * dh_python2: install files listed in debian/pkg.pyinstall file - as public modules for all requested Python versions (use dh_install's - package.install files for private modules); remove public modules listed - in debian/pkg.pyremove (glob.glob pattern and version range can be used in - both files) + * dh_python2: + - make the error message about missing extension more clear + (and more verbose in --verbose mode) + - install files listed in debian/pkg.pyinstall file + as public modules for all requested Python versions (use dh_install's + package.install files for private modules) + - remove public modules listed in debian/pkg.pyremove (glob.glob pattern + and version range can be used in both .pyinstall and .pyremove files) + - create symlinks for files installed into /usr/share/pyshared/ if there + are no other public modules available * pycompile: - `pycompile $DESTDIR/usr/lib/python*` will recognize public site-packages directories and use the right interpreter instead of raising KeyError - do not try to check if interpreter is present when version range is - empty (closes: 605356) + empty -- Piotr Ożarowski <piotr@debian.org> Sun, 21 Nov 2010 23:49:32 +0100 diff --git a/dh_python2 b/dh_python2 index 9952d6b6b21d864ba62348fa668b693a98e722ea..6b7756f02c9bb7b934feb752910518dce51037af 100755 --- a/dh_python2 +++ b/dh_python2 @@ -205,6 +205,24 @@ def create_ext_links(dir1): relative_symlink(fpath1, join(dstdir, i)) +def create_public_links(dir1, vrange, root=''): + """Create public module symlinks for given directory.""" + + debian, package, path = dir1.split('/', 2) + versions = get_requested_versions(vrange) + + for fn in os.listdir(dir1): + fpath1 = join(dir1, fn) + if isdir(fpath1): + create_public_links(fpath1, vrange, join(root, fn)) + else: + for version in versions: + dstdir = join(sitedir(version, package), root) + if not exists(dstdir): + os.makedirs(dstdir) + relative_symlink(fpath1, join(dstdir, fn)) + + def share_2x(dir1, dir2, dc=None): """Move common files to pyshared and create symlinks in original locations.""" @@ -281,6 +299,7 @@ def scan(package, dname=None): ('usr/lib/%s', 'usr/lib/games/%s', 'usr/share/%s', 'usr/share/games/%s')] else: + # scan private directory *only* proot = join('debian', package, dname.strip('/')) private_to_check = [dname[1:]] @@ -484,13 +503,18 @@ def main(): options.arch is True and pdetails['arch'] == 'all': continue log.debug('processing package %s...', package) - if not pyinstall(package, options.vrange): - exit(4) - if not pyremove(package, options.vrange): - exit(5) - fix_locations(package) + if not private_dir: + if not pyinstall(package, options.vrange): + exit(4) + if not pyremove(package, options.vrange): + exit(5) + fix_locations(package) stats = scan(package, private_dir) - share(package, stats, options) + if not private_dir: + share(package, stats, options) + pyshared_dir = "debian/%s/usr/share/pyshared/" % package + if not stats['public_vers'] and exists(pyshared_dir): + create_public_links(pyshared_dir, options.vrange) dependencies = Dependencies(package, dh.packages[package]['uses_breaks']) @@ -524,7 +548,7 @@ def main(): ext_for = details.get('public_ext') if ext_for is None: # no extension - if options.vrange: + if options.vrange and options.vrange != (None, None): args += " -V %s" % vrange_str(options.vrange) elif ext_for is False: # extension's version not detected if options.vrange and '-' not in vrange_str(options.vrange): diff --git a/tests/Makefile b/tests/Makefile index 9d938246be68625a7e955222e754ceaaa0556f31..61610d22a3d6d07a880fed8deb6fba786e27cc37 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,7 +1,7 @@ #!/usr/bin/make -f # enable or disable tests here: -TESTS := test1 +TESTS := test1 test2 all: $(TESTS) diff --git a/tests/t2/Makefile b/tests/t2/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7ebf2cee3a116a70387ddf83a148f56128e81ad9 --- /dev/null +++ b/tests/t2/Makefile @@ -0,0 +1,14 @@ +#!/usr/bin/make -f + +all: run check + + +run: clean + dpkg-buildpackage -b -us -uc + +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 + +clean: + ./debian/rules clean diff --git a/tests/t2/__init__.py b/tests/t2/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4c966637ad0f571d2b8775260fa142aff4971cca --- /dev/null +++ b/tests/t2/__init__.py @@ -0,0 +1 @@ +print("I'm __init__.py") diff --git a/tests/t2/bar.py b/tests/t2/bar.py new file mode 100644 index 0000000000000000000000000000000000000000..f64f1236298b2861db4c21498c19ae92cb22461d --- /dev/null +++ b/tests/t2/bar.py @@ -0,0 +1 @@ +print("I'm bar") diff --git a/tests/t2/debian/changelog b/tests/t2/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..0f9a1683f6506f544c30b1c993ceb553dfd7d6b9 --- /dev/null +++ b/tests/t2/debian/changelog @@ -0,0 +1,5 @@ +foo (0.1.1) unstable; urgency=low + + * Initial release + + -- Piotr Ożarowski <piotr@debian.org> Sat, 27 Feb 2010 20:42:17 +0100 diff --git a/tests/t2/debian/compat b/tests/t2/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/tests/t2/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/t2/debian/control b/tests/t2/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..84f434f42cbb33c68f78c5af749e282e17e84b63 --- /dev/null +++ b/tests/t2/debian/control @@ -0,0 +1,18 @@ +Source: foo +Section: python +Priority: optional +Maintainer: Piotr Ożarowski <piotr@debian.org> +Build-Depends: debhelper (>= 7.0.50~) +Build-Depends-Indep: python-all +Standards-Version: 3.9.1 +XS-Python-Version: >= 2.1 + +Package: python-foo +Architecture: all +Depends: ${python:Depends}, ${misc:Depends} +Recommends: ${python:Recommends} +Suggests: ${python:Suggests} +Enhances: ${python:Enhances} +Breaks: ${python:Breaks} +Description: foo to rule them all + exemple package #2 diff --git a/tests/t2/debian/copyright b/tests/t2/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..63829449e43c160582d21d7b484d145c0b2ac187 --- /dev/null +++ b/tests/t2/debian/copyright @@ -0,0 +1,2 @@ +The Debian packaging is © 2010, Piotr Ożarowski <piotr@debian.org> and +is licensed under the MIT License. diff --git a/tests/t2/debian/install b/tests/t2/debian/install new file mode 100644 index 0000000000000000000000000000000000000000..e3e06e3e1f6f841abdb4fb059c106e7940c4fbf0 --- /dev/null +++ b/tests/t2/debian/install @@ -0,0 +1,3 @@ +foo.py /usr/share/pyshared/ +__init__.py /usr/share/pyshared/bar/ +bar.py /usr/share/pyshared/bar/ diff --git a/tests/t2/debian/rules b/tests/t2/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..0b2b58b2cf8f24be95932af9135995f079c645ab --- /dev/null +++ b/tests/t2/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f +%: + dh $@ --buildsystem=python_distutils + +override_dh_pysupport: + DH_VERBOSE=1 ../../dh_python2 + +clean: + dh_clean diff --git a/tests/t2/debian/source/format b/tests/t2/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..89ae9db8f88b823b6a7eabf55e203658739da122 --- /dev/null +++ b/tests/t2/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/tests/t2/foo.py b/tests/t2/foo.py new file mode 100644 index 0000000000000000000000000000000000000000..8e4dd8e1cff87eb8bcf2714b5a659e2e88fa69cf --- /dev/null +++ b/tests/t2/foo.py @@ -0,0 +1 @@ +print("I'm foo") diff --git a/tests/t2/setup.py b/tests/t2/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391