summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-04-01 17:40:54 +0200
committerJulian Andres Klode <jak@debian.org>2009-04-01 17:40:54 +0200
commit75eeb9186bd254f60964d2ec9e70c45ecc92a247 (patch)
treef976207303584c5006f6ad48455fabfa97078ce7
parentc884ff15493617480ac2fa5a4bbbd75cce3f9a51 (diff)
parentb2d0d968e0aa3e3211b1a697c02117b7c09fb384 (diff)
downloadpython-apt-75eeb9186bd254f60964d2ec9e70c45ecc92a247.tar.gz
python-apt (0.7.10) unstable; urgency=low
* Build-Depend on python-debian, use it to get version number from changelog * Depend on libjs-jquery, and remove internal copy (Closes: #521532) * apt/package.py: - Introduce Version.{uri,uris,fetch_binary()} * debian/control: - Remove mdz from Uploaders (Closes: #521477), add myself. - Update Standards-Version to 3.8.1 - Use ${binary:Version} instead of ${Source-Version} - Fix spelling error: python -> Python * debian/copyright: Switch to machine-interpretable copyright * Fix documentation building - doc/source/conf.py: Only include directories for current python version. - debian/control: Build-Depend on python-gtk2, python-vte. - setup.py: If pygtk can not be imported, do not build the documentation. * Breaks: debdelta (<< 0.28~) to avoid more problems due to the internal API changes from 0.7.9. -- Julian Andres Klode <jak@debian.org> Wed, 01 Apr 2009 15:24:29 +0200
-rw-r--r--apt/__init__.py18
-rw-r--r--apt/cache.py2
-rw-r--r--apt/cdrom.py2
-rw-r--r--apt/debfile.py31
-rw-r--r--apt/package.py118
-rw-r--r--apt/progress/__init__.py4
-rw-r--r--apt/progress/gtk2.py2
-rw-r--r--aptsources/distinfo.py10
-rw-r--r--aptsources/distro.py4
-rw-r--r--aptsources/sourceslist.py12
-rw-r--r--debian/changelog23
-rw-r--r--debian/control28
-rw-r--r--debian/copyright58
-rwxr-xr-xdebian/rules6
-rw-r--r--doc/source/conf.py13
-rwxr-xr-xsetup.py27
16 files changed, 287 insertions, 71 deletions
diff --git a/apt/__init__.py b/apt/__init__.py
index e3cfacbe..ae2abbf2 100644
--- a/apt/__init__.py
+++ b/apt/__init__.py
@@ -1,3 +1,21 @@
+# Copyright (c) 2005-2009 Canonical
+#
+# Author: Michael Vogt <michael.vogt@ubuntu.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
# import the core of apt_pkg
import apt_pkg
import sys
diff --git a/apt/cache.py b/apt/cache.py
index a9430d6b..cc425ccb 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -1,6 +1,6 @@
# cache.py - apt cache abstraction
#
-# Copyright (c) 2005 Canonical
+# Copyright (c) 2005-2009 Canonical
#
# Author: Michael Vogt <michael.vogt@ubuntu.com>
#
diff --git a/apt/cdrom.py b/apt/cdrom.py
index 61250fc4..b52762ad 100644
--- a/apt/cdrom.py
+++ b/apt/cdrom.py
@@ -1,6 +1,6 @@
# cdrom.py - CDROM handling
#
-# Copyright (c) 2005 Canonical
+# Copyright (c) 2005-2009 Canonical
# Copyright (c) 2009 Julian Andres Klode <jak@debian.org>
#
# Author: Michael Vogt <michael.vogt@ubuntu.com>
diff --git a/apt/debfile.py b/apt/debfile.py
index c550d766..0406a250 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -1,24 +1,21 @@
-# Copyright (c) 2005-2007 Canonical
+# Copyright (c) 2005-2009 Canonical
#
-# AUTHOR:
-# Michael Vogt <mvo@ubuntu.com>
+# Author: Michael Vogt <michael.vogt@ubuntu.com>
#
-# This file is part of GDebi
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
#
-# GDebi is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2 of the License, or (at
-# your option) any later version.
-#
-# GDebi is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GDebi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
"""Classes for working with locally available Debian packages."""
from gettext import gettext as _
import os
diff --git a/apt/package.py b/apt/package.py
index 37cd33fb..9afe1674 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -1,6 +1,6 @@
# package.py - apt package abstraction
#
-# Copyright (c) 2005 Canonical
+# Copyright (c) 2005-2009 Canonical
#
# Author: Michael Vogt <michael.vogt@ubuntu.com>
#
@@ -41,6 +41,17 @@ def _(string):
return gettext.dgettext("python-apt", string)
+def _file_is_same(path, size, md5):
+ """Return True if the file is the same."""
+ if (os.path.exists(path) and os.path.getsize(path) == size and
+ apt_pkg.md5sum(open(path)) == md5):
+ return True
+
+
+class FetchError(Exception):
+ """Raised when a file could not be fetched."""
+
+
class BaseDependency(object):
"""A single dependency.
@@ -338,10 +349,87 @@ class Version(object):
origins.append(Origin(self.package, verFileIter))
return origins
- def fetch_source(self):
- """Get the source code of a package"""
+ @property
+ def filename(self):
+ """Return the path to the file inside the archive."""
+ return self._records.FileName
+
+ @property
+ def md5(self):
+ """Return the md5sum of the binary."""
+ return self._records.MD5Hash
+
+ @property
+ def sha1(self):
+ """Return the sha1sum of the binary."""
+ return self._records.SHA1Hash
+
+ @property
+ def sha256(self):
+ """Return the sha1sum of the binary."""
+ return self._records.SHA256Hash
+
+ def _uris(self):
+ """Return an iterator over all available urls."""
+ for (packagefile, index) in self._cand.FileList:
+ indexfile = self.package._pcache._list.FindIndex(packagefile)
+ if indexfile:
+ yield indexfile.ArchiveURI(self._records.FileName)
+
+ @property
+ def uris(self):
+ """Return a list of all available uris for the binary."""
+ return list(self._uris())
+
+ @property
+ def uri(self):
+ """Return a single URI for the binary."""
+ return self._uris().next()
+
+ def fetch_binary(self, destdir='', progress=None):
+ """Fetch the binary version of the package.
+
+ The parameter 'destdir' specifies the directory where the package will
+ be fetched to.
+
+ The parameter 'progress' may refer to an apt.progress.FetchProgress()
+ object. If not specified or None, apt.progress.TextFetchProgress() is
+ used.
+ """
+ base = os.path.basename(self._records.FileName)
+ destfile = os.path.join(destdir, base)
+ if _file_is_same(destfile, self.size, self._records.MD5Hash):
+ print 'Ignoring already existing file:', destfile
+ return
+ acq = apt_pkg.GetAcquire(progress or apt.progress.TextFetchProgress())
+ apt_pkg.GetPkgAcqFile(acq, self.uri, self._records.MD5Hash, self.size,
+ base, destFile=destfile)
+ acq.Run()
+ for item in acq.Items:
+ if item.Status != item.StatDone:
+ raise FetchError("The item %r could not be fetched: %s" %
+ (item.DestFile, item.ErrorText))
+ return os.path.abspath(destfile)
+
+ def fetch_source(self, destdir="", progress=None, unpack=True):
+ """Get the source code of a package.
+
+ The parameter 'destdir' specifies the directory where the source will
+ be fetched to.
+
+ The parameter 'progress' may refer to an apt.progress.FetchProgress()
+ object. If not specified or None, apt.progress.TextFetchProgress() is
+ used.
+
+ The parameter 'unpack' describes whether the source should be unpacked
+ (True) or not (False). By default, it is unpacked.
+
+ If 'unpack' is True, the path to the extracted directory is returned.
+ Otherwise, the path to the .dsc file is returned.
+ """
src = apt_pkg.GetPkgSrcRecords()
- acq = apt_pkg.GetAcquire(apt.progress.TextFetchProgress())
+ acq = apt_pkg.GetAcquire(progress or apt.progress.TextFetchProgress())
+
dsc = None
src.Lookup(self.package.name)
try:
@@ -351,23 +439,33 @@ class Version(object):
raise ValueError("No source for %r" % self)
for md5, size, path, type in src.Files:
base = os.path.basename(path)
+ destfile = os.path.join(destdir, base)
if type == 'dsc':
- dsc = base
+ dsc = destfile
if os.path.exists(base) and os.path.getsize(base) == size:
fobj = open(base)
try:
if apt_pkg.md5sum(fobj) == md5:
- print 'Ignoring already existing file', base
+ print 'Ignoring already existing file:', destfile
continue
finally:
fobj.close()
apt_pkg.GetPkgAcqFile(acq, src.Index.ArchiveURI(path), md5, size,
- base)
+ base, destFile=destfile)
acq.Run()
- outdir = src.Package + '-' + apt_pkg.UpstreamVersion(src.Version)
- subprocess.check_call(["dpkg-source", "-x", dsc, outdir])
- return os.path.abspath(outdir)
+ for item in acq.Items:
+ if item.Status != item.StatDone:
+ raise FetchError("The item %r could not be fetched: %s" %
+ (item.DestFile, item.ErrorText))
+
+ if unpack:
+ outdir = src.Package + '-' + apt_pkg.UpstreamVersion(src.Version)
+ outdir = os.path.join(destdir, outdir)
+ subprocess.check_call(["dpkg-source", "-x", dsc, outdir])
+ return os.path.abspath(outdir)
+ else:
+ return os.path.abspath(dsc)
class Package(object):
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py
index 51eb2426..769942ce 100644
--- a/apt/progress/__init__.py
+++ b/apt/progress/__init__.py
@@ -1,6 +1,6 @@
-# Progress.py - progress reporting classes
+# progress.py - progress reporting classes
#
-# Copyright (c) 2005 Canonical
+# Copyright (c) 2005-2009 Canonical
#
# Author: Michael Vogt <michael.vogt@ubuntu.com>
#
diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py
index 435265d4..f872e34f 100644
--- a/apt/progress/gtk2.py
+++ b/apt/progress/gtk2.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (c) 2004-2005 Canonical
+# Copyright (c) 2004-2009 Canonical
#
# Authors: Michael Vogt <michael.vogt@ubuntu.com>
# Sebastian Heinlein <glatzor@ubuntu.com>
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py
index 59fa7e02..ce44e48b 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -1,12 +1,10 @@
-#!/usr/bin/env python
-#
# distinfo.py - provide meta information for distro repositories
#
-# Copyright (c) 2005 Gustavo Noronha Silva
-# 2006-2007 Sebastian Heinlein
+# Copyright (c) 2005 Gustavo Noronha Silva <kov@debian.org>
+# Copyright (c) 2006-2007 Sebastian Heinlein <glatzor@ubuntu.com>
#
-# Author: Gustavo Noronha Silva <kov@debian.org>
-# Sebastian Heinlein <glatzor@ubuntu.com>
+# Authors: Gustavo Noronha Silva <kov@debian.org>
+# Sebastian Heinlein <glatzor@ubuntu.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
diff --git a/aptsources/distro.py b/aptsources/distro.py
index d81c6e4a..bbb8ba50 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -1,7 +1,7 @@
# distro.py - Provide a distro abstraction of the sources.list
#
-# Copyright (c) 2004-2007 Canonical Ltd.
-# 2006-2007 Sebastian Heinlein
+# Copyright (c) 2004-2009 Canonical Ltd.
+# Copyright (c) 2006-2007 Sebastian Heinlein
#
# Authors: Sebastian Heinlein <glatzor@ubuntu.com>
# Michael Vogt <mvo@debian.org>
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index b1f00446..1dfd870f 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -1,12 +1,12 @@
# aptsource.py - Provide an abstraction of the sources.list
#
-# Copyright (c) 2004-2007 Canonical Ltd.
-# 2004 Michiel Sikkes
-# 2006-2007 Sebastian Heinlein
+# Copyright (c) 2004-2009 Canonical Ltd.
+# Copyright (c) 2004 Michiel Sikkes
+# Copyright (c) 2006-2007 Sebastian Heinlein
#
-# Author: Michiel Sikkes <michiel@eyesopened.nl>
-# Michael Vogt <mvo@debian.org>
-# Sebastian Heinlein <glatzor@ubuntu.com>
+# Authors: Michiel Sikkes <michiel@eyesopened.nl>
+# Michael Vogt <mvo@debian.org>
+# Sebastian Heinlein <glatzor@ubuntu.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
diff --git a/debian/changelog b/debian/changelog
index e570733b..04d6a5d5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,24 @@
+python-apt (0.7.10) unstable; urgency=low
+
+ * Build-Depend on python-debian, use it to get version number from changelog
+ * Depend on libjs-jquery, and remove internal copy (Closes: #521532)
+ * apt/package.py:
+ - Introduce Version.{uri,uris,fetch_binary()}
+ * debian/control:
+ - Remove mdz from Uploaders (Closes: #521477), add myself.
+ - Update Standards-Version to 3.8.1
+ - Use ${binary:Version} instead of ${Source-Version}
+ - Fix spelling error: python -> Python
+ * debian/copyright: Switch to machine-interpretable copyright
+ * Fix documentation building
+ - doc/source/conf.py: Only include directories for current python version.
+ - debian/control: Build-Depend on python-gtk2, python-vte.
+ - setup.py: If pygtk can not be imported, do not build the documentation.
+ * Breaks: debdelta (<< 0.28~) to avoid more problems due to the internal
+ API changes from 0.7.9.
+
+ -- Julian Andres Klode <jak@debian.org> Wed, 01 Apr 2009 15:24:29 +0200
+
python-apt (0.7.9) unstable; urgency=low
[ Julian Andres Klode ]
@@ -22,7 +43,7 @@ python-apt (0.7.9) unstable; urgency=low
- add Recommends to iso-codes (for iso_3166.xml)
* apt/package.py:
- make sure to set the defaulttimeout back to the
- original value (in getChangelog(), LP: #314212)
+ original value (in getChangelog(), LP: #314212)
Closes: #513315
* apt/cache.py:
- when setting a alternative rootdir, read the
diff --git a/debian/control b/debian/control
index 41e3af4a..4c7b542f 100644
--- a/debian/control
+++ b/debian/control
@@ -2,18 +2,30 @@ Source: python-apt
Section: python
Priority: optional
Maintainer: APT Development Team <deity@lists.debian.org>
-Uploaders: Matt Zimmerman <mdz@debian.org>, Michael Vogt <mvo@debian.org>
-Standards-Version: 3.7.2.2
+Uploaders: Michael Vogt <mvo@debian.org>, Julian Andres Klode <jak@debian.org>
+Standards-Version: 3.8.1
XS-Python-Version: all
-Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.7.10), apt-utils, python-all-dev, python-distutils-extra (>= 1.9.0), cdbs, python-central (>= 0.5), python-all-dbg, python-sphinx (>= 0.5)
+Build-Depends: apt-utils,
+ cdbs,
+ debhelper (>= 5.0.37.1),
+ libapt-pkg-dev (>= 0.7.10),
+ python-all-dbg,
+ python-all-dev,
+ python-central (>= 0.5),
+ python-debian,
+ python-distutils-extra (>= 1.9.0),
+ python-gtk2,
+ python-sphinx (>= 0.5),
+ python-vte
Vcs-Bzr: http://bzr.debian.org/apt/python-apt/debian-sid
Vcs-Browser: http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/changes
Package: python-apt
Architecture: any
-Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, lsb-release
+Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, lsb-release,
+ libjs-jquery
Recommends: iso-codes
-Priority: optional
+Breaks: debdelta (<< 0.28~)
Provides: ${python:Provides}
Suggests: python-apt-dbg, python-gtk2, python-vte
XB-Python-Version: ${python:Versions}
@@ -33,10 +45,12 @@ Description: Python interface to libapt-pkg
Package: python-apt-dbg
Priority: extra
Architecture: any
-Depends: python-dbg, python-apt (= ${Source-Version}), ${shlibs:Depends}
+Section: debug
+Depends: python-dbg, python-apt (= ${binary:Version}), ${shlibs:Depends},
+ ${misc:Depends}
Description: Python interface to libapt-pkg (debug extension)
The apt_pkg Python interface will provide full access to the internal
libapt-pkg structures allowing Python programs to easily perform a
variety of functions.
.
- This package contains the extension built for the python debug interpreter.
+ This package contains the extension built for the Python debug interpreter.
diff --git a/debian/copyright b/debian/copyright
index f8463185..8599328a 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,7 +1,53 @@
-APT is free software; you can redistribute them and/or modify them under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=443
-On Debian systems, a copy of the GNU General Public License can be
-found in /usr/share/common-licenses/GPL.
+Files: *
+Copyright: © 2004-2009 Canonical Ltd.
+License: GPL-2+
+
+Files: aptsources/*.py
+Copyright: © 2004-2009 Canonical Ltd.
+Copyright: © 2005 Gustavo Noronha Silva
+Copyright: © 2006-2007 Sebastian Heinlein
+License: GPL-2+
+
+Files: doc/source/*
+Copyright: © 2009 Julian Andres Klode <jak@debian.org>
+License: GPL-2+
+
+Files: utils/get_*.py
+Copyright: © 2006 Free Software Foundation Europe
+License: GPL-2+
+
+Files: po/*
+Copyright: © 2006 Canonical Ltd, and Rosetta Contributors 2006
+License: GPL-2+
+
+Files: po/de.po
+Copyright: © 2005 Michiel Sikkes <michiel@eyesopened.nl>
+License: GPL-2+
+
+Files: po/en_CA.po
+Copyright: © 2005 Adam Weinberger and the GNOME Foundation
+License: GPL-2+
+
+Files: po/fi.po
+Copyright: © 2005-2006 Timo Jyrinki
+License: GPL-2+
+
+Files: po/fr.po
+Copyright: © 2007 Hugues NAULET <hnaulet@gmail.com>
+License: GPL-2+
+
+Files: po/hu.po, po/lt.po, po/pt.po, po/ro.po, po/rw.po, po/sv.po, po/uk.po,
+ po/zh_HK.po
+Copyright: © 2005-2006 Free Software Foundation
+License: GPL-2+
+
+License: GPL-2+
+ APT is free software; you can redistribute them and/or modify them under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+ .
+ On Debian systems, a copy of the GNU General Public License can be
+ found in /usr/share/common-licenses/GPL-2.
diff --git a/debian/rules b/debian/rules
index 90b48cda..a2802ea7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -22,9 +22,6 @@ build/python-apt-dbg::
python$$i-dbg ./setup.py build; \
done
-build/python-apt::
- pydoc -w
-
install/python-apt-dbg::
for i in $(cdbs_python_build_versions); do \
python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python-apt-dbg; \
@@ -33,6 +30,9 @@ install/python-apt-dbg::
! -type d ! -name '*_d.so' | xargs rm -f
find debian/python-apt-dbg -depth -empty -exec rmdir {} \;
+binary-predeb/python-apt::
+ ln -sf ../../../../javascript/jquery/jquery.js debian/python-apt/usr/share/doc/python-apt/html/_static/jquery.js
+
binary-predeb/python-apt-dbg::
rm -rf debian/python-apt-dbg/usr/share/doc/python-apt-dbg
ln -s python-apt debian/python-apt-dbg/usr/share/doc/python-apt-dbg
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 3b0ebed7..40154a6f 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -23,9 +23,13 @@ import sys
# absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../..'))
+
+# Find the path to the built apt_pkg and apt_inst extensions
if os.path.exists("../../build"):
+ version = '.'.join(str(x) for x in sys.version_info[:2])
for dirname in os.listdir('../../build'):
- sys.path.insert(0, os.path.abspath('../../build/' + dirname))
+ if version in dirname:
+ sys.path.insert(0, os.path.abspath('../../build/' + dirname))
# General configuration
# ---------------------
@@ -56,10 +60,13 @@ copyright = u'2009, Julian Andres Klode <jak@debian.org>'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
+from debian_bundle.changelog import Changelog
+
+changes = Changelog(open('../../debian/changelog'))
# The short X.Y version.
-version = '0.7'
+version = '.'.join(changes.full_version.split('.')[:2])
# The full version, including alpha/beta/rc tags.
-release = '0.7.9~exp3'
+release = changes.full_version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/setup.py b/setup.py
index fc046381..3d378050 100755
--- a/setup.py
+++ b/setup.py
@@ -1,14 +1,26 @@
#! /usr/bin/env python
# $Id: setup.py,v 1.2 2002/01/08 07:13:21 jgg Exp $
-
-from distutils.core import setup, Extension
-from distutils.sysconfig import parse_makefile
-from DistUtilsExtra.command import build_extra, build_i18n
import glob
import os
import shutil
import sys
+from distutils.core import setup, Extension
+from distutils.sysconfig import parse_makefile
+from DistUtilsExtra.command import build_extra, build_i18n
+
+
+class FakeDebianSupportModule(object):
+ """Work around the python-apt dependency of debian_support."""
+
+ class Version(object):
+ """Empty class."""
+
+sys.modules['debian_bundle.debian_support'] = FakeDebianSupportModule
+
+from debian_bundle.changelog import Changelog
+
+
# The apt_pkg module
files = map(lambda source: "python/"+source,
@@ -46,7 +58,7 @@ if len(sys.argv) > 1 and sys.argv[1] == "clean" and '-a' in sys.argv:
print "Not removing", dirname, "because it does not exist"
setup(name="python-apt",
- version="0.7.9",
+ version=Changelog(open('debian/changelog')).full_version,
description="Python bindings for APT",
author="APT Development Team",
author_email="deity@lists.debian.org",
@@ -63,6 +75,11 @@ setup(name="python-apt",
if len(sys.argv) > 1 and sys.argv[1] == "build":
import sphinx
+ try:
+ import pygtk
+ except ImportError:
+ print >> sys.stderr, 'E: python-gtk2 is required to build documentation.'
+ sys.exit(0)
sphinx.main(["sphinx", "-b", "html", "-d", "build/doc/doctrees",
os.path.abspath("doc/source"), "build/doc/html"])
sphinx.main(["sphinx", "-b", "text", "-d", "build/doc/doctrees",