diff -Nru python-distutils-extra-2.12/debian/changelog python-distutils-extra-2.17~karmic1/debian/changelog --- python-distutils-extra-2.12/debian/changelog 2009-10-14 12:53:44.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/debian/changelog 2010-02-26 17:24:26.000000000 +0000 @@ -1,3 +1,63 @@ +python-distutils-extra (2.17~karmic1) karmic; urgency=low + + [ Didier Roche ] + * python-mkdebian: + - Use OptionParser for argv processing. + - Add --changelog option to specify changelog message (can be used more + than once for different tasks) + - Add --dependency option to add a manual debian package dependency + (can be used more than once for each package) + + [ Elliot Murphy ] + * python-mkdebian: + - Change from python-central to python-support for consistency with + debian python packaging team preference. + - Update to Standards-Version: 3.8.3 + - Fix a typo that caused additional_dependencies defaulting to None + instead of []. + - If debchange is not available, give a more friendly error message. + (LP: #464137) + + [ Martin Pitt ] + * auto.py: Document handling of icons. + + -- Didier Roche Fri, 26 Feb 2010 18:22:24 +0100 + +python-distutils-extra (2.16) unstable; urgency=low + + * test/auto.py: Make Apport hook test description consistent to other tests. + * build_help.py: Fix --help-dir option, thanks to Severin Heiniger for + spotting this. (LP: #508438) + * auto.py: Clean up temporary *.py symlinks also if there is an exception in + between. (LP: #490985) + + -- Martin Pitt Fri, 29 Jan 2010 18:48:31 +0100 + +python-distutils-extra (2.15) unstable; urgency=low + + * auto.py: Add support for Apport package hooks in apport/*.py. Thanks + Philip Peitsch! (LP: #500316) + + -- Martin Pitt Sun, 03 Jan 2010 22:26:19 +0100 + +python-distutils-extra (2.14) unstable; urgency=low + + * Bump Standards-Version to 3.8.3 (no changes necessary). + * build_i18n.py: Fix crash when setup.py defines no data files. Thanks to + Markus Korn! (LP: #493978) + * auto.py: Preserve symlinks in bin/ and data/. distutils copies them as + files by default, so we have to write the complete handling for those + ourselves. (LP: #392562) + + -- Martin Pitt Tue, 22 Dec 2009 23:47:46 +0100 + +python-distutils-extra (2.13) unstable; urgency=low + + * python-mkdebian: Fix dependency detection for packages which only ship a + Python module, not a package. Thanks Didier Roche! (LP: #482913) + + -- Martin Pitt Mon, 21 Dec 2009 19:12:25 +0100 + python-distutils-extra (2.12) unstable; urgency=low * auto.py: Auto-install GtkBuilder files which have attributes in the diff -Nru python-distutils-extra-2.12/debian/control python-distutils-extra-2.17~karmic1/debian/control --- python-distutils-extra-2.12/debian/control 2009-08-04 15:14:51.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/debian/control 2010-02-26 17:24:26.000000000 +0000 @@ -5,7 +5,7 @@ Maintainer: Sebastian Heinlein Uploaders: Martin Pitt Build-Depends: cdbs, debhelper (>= 5.0.37.2), python-central (>= 0.5), python-all-dev, python-setuptools, python-crypto, python-dateutil, intltool -Standards-Version: 3.8.2 +Standards-Version: 3.8.3 Vcs-Bzr: http://bazaar.launchpad.net/~python-distutils-extra-hackers/python-distutils-extra/debian Vcs-Browser: https://code.launchpad.net/~python-distutils-extra-hackers/python-distutils-extra/debian diff -Nru python-distutils-extra-2.12/debian/local/python-mkdebian python-distutils-extra-2.17~karmic1/debian/local/python-mkdebian --- python-distutils-extra-2.12/debian/local/python-mkdebian 2009-09-11 11:31:40.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/debian/local/python-mkdebian 2010-02-26 17:24:26.000000000 +0000 @@ -4,6 +4,7 @@ # Author: Martin Pitt # License: GPL v2 or later +from optparse import OptionParser import subprocess, tempfile, shutil, sys, os, textwrap def get_egg_info(): @@ -41,7 +42,7 @@ finally: shutil.rmtree(instdir) -def make_debian(egg): +def make_debian(egg, force_control, changelog, additional_dependencies): '''Create/update debian/* from information in egg dictionary''' if not os.path.isdir('debian'): @@ -55,8 +56,7 @@ if not os.path.exists('debian/rules'): f = open('debian/rules', 'w') f.write('''#!/usr/bin/make -f - -DEB_PYTHON_SYSTEM := pycentral +DEB_PYTHON_SYSTEM := pysupport include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk @@ -68,8 +68,8 @@ if not os.path.exists('debian/copyright'): make_copyright(egg) - make_control(egg) - make_changelog(egg) + make_control(egg, force_control, additional_dependencies) + make_changelog(egg, changelog) def make_copyright(egg): author = egg.get('Author', '') @@ -104,7 +104,7 @@ print >> f, ''' The full text of the GPL is distributed in /usr/share/common-licenses/%s on Debian systems.''' % l -def make_control(egg): +def make_control(egg, force_control, additional_dependencies): author = egg.get('Author', '') if 'Author-email' in egg: author += ' <' + egg['Author-email'] + '>' @@ -130,16 +130,16 @@ # prepare tags control_content = {'Depends': '''${misc:Depends}, - ${python:Depends}%s''' % ',\n '.join(['',] + list(deps)) + ${python:Depends}%s''' % ',\n '.join(['',] + list(deps) + additional_dependencies) } # add additional fields (even when updating if user chooses them) - if not os.path.exists('debian/control') or '--force-control' in sys.argv: + if not os.path.exists('debian/control') or force_control: control_content.update({ 'Source': egg['Name'], 'Build-Depends': '''cdbs (>= 0.4.43), debhelper (>= 6), python, - python-central (>= 0.6.11), + python-support (>= 0.6.4), python-distutils-extra (>= 2.10)%s''' % bdeps, 'Maintainer': author, 'Package': egg['Name'], @@ -153,7 +153,7 @@ Priority: extra Build-Depends: %(Build-Depends)s Maintainer: %(Maintainer)s -Standards-Version: 3.8.2 +Standards-Version: 3.8.3 XS-Python-Version: current Package: %(Package)s @@ -193,25 +193,35 @@ raise os.rename('debian/control.new', 'debian/control') -def make_changelog(egg): +def make_changelog(egg, changelog): lsb_release = subprocess.Popen(['lsb_release', '-sc'], stdout=subprocess.PIPE) release = lsb_release.communicate()[0].strip() assert lsb_release.returncode == 0 + if not os.path.exists('/usr/bin/debchange'): + print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \ + 'You need to install the "devscripts" package for this.' + sys.exit(0) + if not os.path.exists('debian/changelog'): + if not changelog: + changelog = ['Initial release.'] try: assert subprocess.call(['debchange', '--create', '--package', egg['Name'], - '-D' + release, '-v' + egg['Version'], 'Initial release.']) == 0 + '-D' + release, '-v' + egg['Version'], changelog[0]]) == 0 except OSError, e: print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \ 'You need to install the "devscripts" package for this.' % str(e) sys.exit(0) else: + if not changelog: + changelog = ['New release.'] # this will just fail if we already have that version, which is okay. subprocess.call(['debchange', '-D' + release, '-v' + egg['Version'], - 'New release.'], stderr=subprocess.PIPE) - # TODO: add CLI option to specify changelog + changelog[0]], stderr=subprocess.PIPE) + for message in changelog[1:]: + subprocess.call(['debchange', message]) def mod2package(module): '''Convert Python module into a package name. @@ -224,7 +234,9 @@ dpkg = subprocess.Popen(['dpkg', '-L', package], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0] - if dpkg.returncode == 0 and '/%s/__init__.py\n' % module.replace('.', '/') in out: + if dpkg.returncode == 0 and \ + ('/%s/__init__.py\n' % module.replace('.', '/') in out or \ + '/%s.py\n' % module.replace('.', '/') in out): return package # bigger hammer: dpkg -S for Python packages @@ -266,6 +278,18 @@ # # main # +usage = "usage: %prog [options]" +parser = OptionParser(prog='python_mkdebian', usage=usage) +parser.add_option('', '--force-control', dest='force_control', action='store_true', + help='Force whole control file to be recreated') +parser.add_option('', '--changelog', dest='changelog', action='append', + help='Add string changelog to debian/changelog (can be specified multiple times)') +parser.add_option('', '--dependency', dest='dependencies', action='append', + help='Add additional debian package dependency (can be specified multiple times)') +parser.set_defaults(changelog=None, dependencies=[]) +options, args = parser.parse_args() egg = get_egg_info() -make_debian(egg) +make_debian(egg, force_control=options.force_control, + changelog=options.changelog, + additional_dependencies=options.dependencies) diff -Nru python-distutils-extra-2.12/DistUtilsExtra/auto.py python-distutils-extra-2.17~karmic1/DistUtilsExtra/auto.py --- python-distutils-extra-2.12/DistUtilsExtra/auto.py 2009-10-14 12:50:18.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/DistUtilsExtra/auto.py 2010-02-26 17:24:26.000000000 +0000 @@ -17,12 +17,14 @@ * Desktop files (*.desktop.in) [into prefix/share/applications, or prefix/share/autostart if they have "autostart" anywhere in the path] * KDE4 notifications (*.notifyrc.in) + * Apport hooks (apport/*) [installed into /usr/share/apport/package-hooks] * scripts (all in bin/, and ./ * Auxiliary data files (in data/*) [into prefix/share//] * automatic po/POTFILES.in (with all source files which contain _()) * automatic MANIFEST (everything except swap and backup files, *.pyc, and revision control) * manpages (*.[0-9]) + * icons (data/icons///*.{svg,png}) * files which should go into /etc (./etc/*, copied verbatim) * determining "requires" from import statements in source code * determining "provides" from shipped packages and modules @@ -32,7 +34,7 @@ author, license, etc.) in ./setup.py. ''' -__version__ = '2.10' +__version__ = '2.15' # (c) 2009 Canonical Ltd. # Author: Martin Pitt @@ -80,6 +82,7 @@ __packages(attrs, src) __provides(attrs, src) __dbus(attrs, src) + __apport_hooks(attrs, src) __data(attrs, src) __scripts(attrs, src) __stdfiles(attrs, src) @@ -189,6 +192,20 @@ if session_service: v.append(('share/dbus-1/services', session_service)) +def __apport_hooks(attrs, src): + '''Apport hooks''' + v = attrs.setdefault('data_files', []) + + # files will be copied to /usr/share/apport/package-hooks/ + hooks = [] + assert 'name' in attrs, 'You need to set the "name" property in setup.py' + for f in src_fileglob(src, '*.py'): + if f.startswith('apport/'): + hooks.append(f) + src_mark(src, f) + if hooks: + v.append(('share/apport/package-hooks/', hooks)) + def __data(attrs, src): '''Install auxiliary data files. @@ -203,7 +220,9 @@ for f in src.copy(): if f.startswith('data/') and not f.startswith('data/icons/') and \ not f.endswith('.desktop.in') and not f.endswith('*.notifyrc.in'): - v.append((os.path.join('share', attrs['name'], os.path.dirname(f[5:])), [f])) + if not os.path.islink(f): + # symlinks are handled in install_auto + v.append((os.path.join('share', attrs['name'], os.path.dirname(f[5:])), [f])) src_mark(src, f) def __scripts(attrs, src): @@ -218,10 +237,13 @@ scripts = [] for f in src.copy(): if f.startswith('bin/') or f == attrs['name']: - st = os.stat(f) + st = os.lstat(f) if stat.S_ISREG(st.st_mode) and st.st_mode & stat.S_IEXEC: scripts.append(f) src_mark(src, f) + elif stat.S_ISLNK(st.st_mode): + # symlinks are handled in install_auto + src_mark(src, f) if scripts: v = attrs.setdefault('scripts', []) @@ -519,45 +541,46 @@ auto_potfiles_in = False exe_symlinks = [] global src_all - if not os.path.exists(os.path.join('po', 'POTFILES.in')): - files = src_fileglob(src_all, '*.py') - files.update(src_fileglob(src_all, '*.desktop.in')) - files.update(src_fileglob(src_all, '*.notifyrc.in')) - files.update(src_fileglob(src_all, '*.policy.in')) - - for f in src_fileglob(src_all, '*.ui'): - contents = open(f).read() - if ('\n' in contents or '> potfiles_in, '[encoding: UTF-8]' + for f in files: + print >> potfiles_in, f + potfiles_in.close() + + auto_potfiles_in = True + + build_i18n.build_i18n.run(self) + finally: + for f in exe_symlinks: + os.unlink(f) if auto_potfiles_in: os.unlink('po/POTFILES.in') @@ -625,7 +648,7 @@ self.filelist.append(f) # -# Automatic installation of ./etc/ +# Automatic installation of ./etc/ and symlinks # class install_auto(distutils.command.install.install): @@ -634,7 +657,7 @@ if os.path.isdir('etc'): # work around a bug in copy_tree() which fails with "File exists" on # previously existing symlinks - for f in distutils.filelist.findall(): + for f in distutils.filelist.findall('etc'): if not f.startswith('etc' + os.path.sep) or not os.path.islink(f): continue try: @@ -645,5 +668,27 @@ distutils.dir_util.copy_tree('etc', os.path.join(self.root, 'etc'), preserve_times=0, preserve_symlinks=1, verbose=1) + # install data/scripts symlinks + for f in distutils.filelist.findall(): + if not os.path.islink(f): + continue + if f.startswith('bin/') or f.startswith('data/'): + if f.startswith('bin'): + dir = self.install_scripts + dest = os.path.join(dir, os.path.sep.join(f.split(os.path.sep)[1:])) + elif f.startswith('data/icons'): + dir = os.path.join(self.install_data, 'share', 'icons', 'hicolor') + dest = os.path.join(dir, os.path.sep.join(f.split(os.path.sep)[2:])) + else: + dir = os.path.join(self.install_data, 'share', self.distribution.get_name()) + dest = os.path.join(dir, os.path.sep.join(f.split(os.path.sep)[1:])) + + d = os.path.dirname(dest) + if not os.path.isdir(d): + os.makedirs(d) + if os.path.exists(dest): + os.unlink(dest) + os.symlink(os.readlink(f), dest) + distutils.command.install.install.run(self) diff -Nru python-distutils-extra-2.12/DistUtilsExtra/command/build_help.py python-distutils-extra-2.17~karmic1/DistUtilsExtra/command/build_help.py --- python-distutils-extra-2.12/DistUtilsExtra/command/build_help.py 2009-08-08 08:10:55.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/DistUtilsExtra/command/build_help.py 2010-02-26 17:24:26.000000000 +0000 @@ -6,7 +6,7 @@ class build_help(distutils.cmd.Command): description = 'install docbook XML based documentation' - user_options= [('help_dir', None, 'help directory in the source tree')] + user_options= [('help-dir', None, 'help directory in the source tree')] def initialize_options(self): self.help_dir = None diff -Nru python-distutils-extra-2.12/DistUtilsExtra/command/build_i18n.py python-distutils-extra-2.17~karmic1/DistUtilsExtra/command/build_i18n.py --- python-distutils-extra-2.12/DistUtilsExtra/command/build_i18n.py 2009-06-25 11:45:43.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/DistUtilsExtra/command/build_i18n.py 2010-02-26 17:24:26.000000000 +0000 @@ -60,6 +60,9 @@ return data_files = self.distribution.data_files + if data_files is None: + # in case not data_files are defined in setup.py + self.distribution.data_files = data_files = [] if self.bug_contact is not None: os.environ["XGETTEXT_ARGS"] = "--msgid-bugs-address=%s " % \ diff -Nru python-distutils-extra-2.12/setup.py python-distutils-extra-2.17~karmic1/setup.py --- python-distutils-extra-2.12/setup.py 2009-09-11 11:28:16.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/setup.py 2010-02-26 17:24:26.000000000 +0000 @@ -5,7 +5,7 @@ setup( name = 'python-distutils-extra', - version = '2.10', + version = '2.15', author = 'Sebastian Heinlein, Martin Pitt', author_email = 'sebi@glatzor.de, martin.pitt@ubuntu.com', description = 'Add support for i18n, documentation and icons to distutils', diff -Nru python-distutils-extra-2.12/test/auto.py python-distutils-extra-2.17~karmic1/test/auto.py --- python-distutils-extra-2.12/test/auto.py 2009-10-14 12:47:27.000000000 +0100 +++ python-distutils-extra-2.17~karmic1/test/auto.py 2010-02-26 17:24:26.000000000 +0000 @@ -153,6 +153,27 @@ self.assert_('/usr/share/dbus-1/services/com.example.foo.gui.service' in f) self.failIf('super.service' in '\n'.join(f)) + def test_apport_hook(self): + '''Apport hooks''' + + self._mksrc('apport/foo.py', '''import os, apport +def add_info(report): + pass +''') + + self._mksrc('apport/source_foo.py', '''import os, apport +def add_info(report): + pass +''') + + (o, e, s) = self.do_install() + self.failIf('following files are not recognized' in o, o) + + f = self.installed_files() + self.assertEqual(len(f), 3, f) # 2 hook files plus .egg-info + self.assert_('/usr/share/apport/package-hooks/foo.py' in f, f) + self.assert_('/usr/share/apport/package-hooks/source_foo.py' in f, f) + def test_po(self): '''gettext *.po files''' @@ -280,9 +301,8 @@ self.assert_('/usr/share/icons/hicolor/scalable/actions/press.png' in f) self.assert_('/usr/share/icons/hicolor/scalable/actions/crunch.png' in f) self.assert_('/usr/share/icons/hicolor/48x48/apps/foo.png' in f) - # TODO: known to fail right now - #self.assert_(os.path.islink(os.path.join(self.install_tree, - # '/usr/share/icons/hicolor/scalable/actions/crunch.png')) + self.assert_(os.path.islink(os.path.join(self.install_tree, + 'usr/share/icons/hicolor/scalable/actions/crunch.png'))) def test_data(self): '''Auxiliary files in data/''' @@ -315,6 +335,7 @@ self._mksrc('data/40-foo.rules') self._mksrc('data/blob1.conf') self._mksrc('data/blob2.conf') + os.symlink('stuff', os.path.join(self.src, 'data', 'stufflink')) (o, e, s) = self.do_install() self.assertEqual(e, '') @@ -323,6 +344,9 @@ f = self.installed_files() self.assert_('/usr/share/foo/stuff' in f) + self.assert_('/usr/share/foo/stufflink' in f) + self.assert_(os.path.islink(os.path.join(self.install_tree, 'usr', + 'share', 'foo', 'stufflink'))) self.assert_('/usr/share/foo/handlers/red.py' in f) self.assert_('/usr/share/foo/handlers/blue.py' in f) self.assert_('/lib/udev/rules.d/40-foo.rules' in f) @@ -338,6 +362,7 @@ self._mksrc('bin/yell', '#!/bin/sh', True) self._mksrc('bin/shout', '#!/bin/sh', True) self._mksrc('bin/foo', '#!/bin/sh', True) + os.symlink('shout', os.path.join(self.src, 'bin', 'shoutlink')) # these shouldn't self._mksrc('daemon/food', '#!/bin/sh', True) # not in bin/ @@ -355,6 +380,9 @@ f = self.installed_files() self.assert_('/usr/bin/yell' in f) self.assert_('/usr/bin/shout' in f) + self.assert_('/usr/bin/shoutlink' in f) + self.assert_(os.path.islink(os.path.join(self.install_tree, 'usr', + 'bin', 'shoutlink'))) self.assert_('/usr/bin/foo' in f) ftext = '\n'.join(f) self.failIf('food' in ftext)