From 10858f98f759a2407ac596582687581a2ed33d34 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 29 Mar 2009 16:35:39 +0200 Subject: Build-Depend on python-debian, use it to get version number from changelog --- setup.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index fc046381..1c266ce7 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", -- cgit v1.2.3 From 192a186f6613f02e0fcef12da11412ec6001ed8c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 1 Apr 2009 17:11:16 +0200 Subject: * 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. --- debian/changelog | 4 ++++ debian/control | 4 +++- doc/source/conf.py | 6 +++++- setup.py | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/debian/changelog b/debian/changelog index 91ce7304..4bc94036 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,10 @@ python-apt (0.7.10~exp1) experimental; urgency=low - Update Standards-Version to 3.8.1 - Use ${binary:Version} instead of ${Source-Version} * 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. -- Julian Andres Klode Wed, 01 Apr 2009 15:24:29 +0200 diff --git a/debian/control b/debian/control index 9afd50e0..c06611e2 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,9 @@ Build-Depends: apt-utils, python-central (>= 0.5), python-debian, python-distutils-extra (>= 1.9.0), - python-sphinx (>= 0.5) + 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 diff --git a/doc/source/conf.py b/doc/source/conf.py index 17fe6a23..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 # --------------------- diff --git a/setup.py b/setup.py index 1c266ce7..3d378050 100755 --- a/setup.py +++ b/setup.py @@ -75,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", -- cgit v1.2.3