summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rw-r--r--debian/control4
-rw-r--r--debian/python-apt.doc-base3
-rw-r--r--debian/python-apt.docs3
-rwxr-xr-xdebian/rules35
-rw-r--r--po/python-apt.pot2
-rw-r--r--python/makefile27
-rw-r--r--[-rwxr-xr-x]setup.py73
-rw-r--r--setup3.py77
9 files changed, 43 insertions, 182 deletions
diff --git a/debian/changelog b/debian/changelog
index 70157470..5e3ec667 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,7 @@ python-apt (0.7.92) UNRELEASED; urgency=low
* Upgrade to debhelper 7 and remove debian/tmp in python-apt.install, to
work around a bug in debhelper.
* Build-Depend on python-all-dev (>= 2.5.4-3), so we build for Python 2.6
+ * Simplify the whole building, build all Python versions with setup.py
[ Sebastian Heinlein ]
* apt/progress.py: Extract the package name from the status message
diff --git a/debian/control b/debian/control
index 9e0fe3ea..36a4d8d8 100644
--- a/debian/control
+++ b/debian/control
@@ -8,13 +8,13 @@ XS-Python-Version: >= 2.5
Build-Depends: apt-utils,
cdbs,
debhelper (>= 7),
- libapt-pkg-dev (>= 0.7.22~),
+ libapt-pkg-dev (>= 0.7.12~),
python-all-dbg (>= 2.5.4-3),
python-all-dev (>= 2.5.4-3),
python3.1-dev,
python3.1-dbg,
python-central (>= 0.5),
- python-distutils-extra (>= 1.9.0),
+ python-distutils-extra (>= 2.0),
python-gtk2,
python-sphinx (>= 0.5),
python-vte
diff --git a/debian/python-apt.doc-base b/debian/python-apt.doc-base
index d25926b7..e9b2040c 100644
--- a/debian/python-apt.doc-base
+++ b/debian/python-apt.doc-base
@@ -6,6 +6,3 @@ Section: Programming/Python
Format: HTML
Index: /usr/share/doc/python-apt/html/index.html
Files: /usr/share/doc/python-apt/html/*
-
-Format: Text
-Files: /usr/share/doc/python-apt/text/*
diff --git a/debian/python-apt.docs b/debian/python-apt.docs
index 6ba083f5..29219341 100644
--- a/debian/python-apt.docs
+++ b/debian/python-apt.docs
@@ -1,5 +1,4 @@
README
apt/README.apt
data/templates/README.templates
-build/doc/html/
-build/doc/text/
+build/sphinx/html/
diff --git a/debian/rules b/debian/rules
index f9b08384..967da911 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,56 +11,29 @@ DEB_PYTHON_PACKAGES_EXCLUDE=python-apt-dbg
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
-PY3K_VERSIONS := $(shell find /usr/bin/python3.? | sed s/.*python//)
-2TO3_VERSION := $(lastword $(PY3K_VERSIONS))
+# Add python3 versions to the list of python versions
+cdbs_python_build_versions += $(shell find /usr/bin/python3.? | sed s/.*python//)
+
-PKG=python-apt
DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
DEB_COMPRESS_EXCLUDE:=.html .js _static/* _sources/* _sources/*/* .inv
DEB_PYTHON_INSTALL_ARGS_ALL=--no-compile --install-layout=deb
-DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
# Define COMPAT_0_7 to get all the deprecated interfaces.
export CFLAGS+=-DCOMPAT_0_7 -Wno-write-strings
export DEBVER
-build/python-apt::
- set -e; for i in $(PY3K_VERSIONS); do \
- python$$i setup3.py build; \
- done
-
-install/python-apt::
- set -e; for i in $(PY3K_VERSIONS); do \
- python$$i ./setup3.py install --root $(CURDIR)/debian/python-apt \
- --install-layout=deb --no-compile; \
- done
-
-ifneq ($(PY3K_VERSIONS),)
- find $(CURDIR)/debian/python-apt/usr/lib/python3*/dist-packages/ -name '*.py' \
- | xargs 2to3-$(2TO3_VERSION)| patch -p0
-endif
-
build/python-apt-dbg::
set -e; \
for i in $(cdbs_python_build_versions); do \
python$$i-dbg ./setup.py build; \
done
- set -e; for i in $(PY3K_VERSIONS); do \
- python$$i-dbg setup3.py build; \
- done
-
install/python-apt-dbg::
for i in $(cdbs_python_build_versions); do \
python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python-apt-dbg \
- --no-compile; \
+ $(DEB_PYTHON_INSTALL_ARGS_ALL); \
done
-
- set -e; for i in $(PY3K_VERSIONS); do \
- python$$i-dbg ./setup3.py install --root $(CURDIR)/debian/python-apt-dbg \
- --install-layout=deb --no-compile; \
- done
-
find debian/python-apt-dbg \
! -type d ! -name '*_d.so' | xargs rm -f
find debian/python-apt-dbg -depth -empty -exec rmdir {} \;
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 3f4fbb6b..3becb5e1 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-07-15 15:17+0200\n"
+"POT-Creation-Date: 2009-07-15 16:51+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/python/makefile b/python/makefile
deleted file mode 100644
index fff3a2e8..00000000
--- a/python/makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- make -*-
-BASE=..
-SUBDIR=python
-
-# Bring in the default rules
-include ../buildlib/defaults.mak
-
-# The apt_pkg module
-MODULE=apt_pkg
-SLIBS = -lapt-pkg
-LIB_MAKES = apt-pkg/makefile
-APT_PKG_SRC = apt_pkgmodule.cc configuration.cc generic.cc tag.cc string.cc \
- cache.cc pkgrecords.cc pkgsrcrecords.cc sourcelist.cc \
- depcache.cc progress.cc cdrom.cc acquire.cc pkgmanager.cc \
- indexfile.cc metaindex.cc hashstring.cc indexrecords.cc \
- policy.cc hashes.cc
-SOURCE := $(APT_PKG_SRC)
-include $(PYTHON_H) progress.h
-
-# The apt_int module..
-MODULE=apt_inst
-SLIBS = -lapt-inst -lapt-pkg
-LIB_MAKES = apt-inst/makefile
-APT_INST_SRC = apt_instmodule.cc tar.cc generic.cc
-SOURCE := $(APT_INST_SRC)
-include $(PYTHON_H)
-
diff --git a/setup.py b/setup.py
index 85f4c889..77853a4e 100755..100644
--- a/setup.py
+++ b/setup.py
@@ -1,50 +1,59 @@
-#! /usr/bin/env python
+#!/usr/bin/python
+# Builds on python2.X and python3
# $Id: setup.py,v 1.2 2002/01/08 07:13:21 jgg Exp $
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
+cmdclass = {}
+try:
+ from DistUtilsExtra.command import build_extra, build_i18n
+ from DistUtilsExtra.auto import clean_build_tree
+ cmdclass['build'] = build_extra.build_extra
+ cmdclass['build_i18n'] = build_i18n.build_i18n
+ cmdclass['clean'] = clean_build_tree
+ build_extra.build_extra.sub_commands.append(("build_sphinx",
+ lambda x: 'build_sphinx' in cmdclass))
+except ImportError:
+ print('W: [python%s] DistUtilsExtra import error.' % sys.version[:3])
-# The apt_pkg module
-files = map(lambda source: "python/"+source,
- sorted(parse_makefile("python/makefile")["APT_PKG_SRC"].split()))
+try:
+ from sphinx.setup_command import BuildDoc
+ cmdclass['build_sphinx'] = BuildDoc
+except ImportError:
+ print('W: [python%s] Sphinx import error.' % sys.version[:3])
+
+if sys.version_info[0] == 3:
+ from distutils.command.build_py import build_py_2to3
+ cmdclass['build_py'] = build_py_2to3
+
+# The apt_pkg module.
+files = ['apt_pkgmodule.cc', 'acquire.cc', 'cache.cc', 'cdrom.cc',
+ 'configuration.c', 'depcache.cc', 'generic.cc', 'hashes.cc',
+ 'hashstring.cc', 'indexfile.cc', 'indexrecords.cc', 'metaindex.cc',
+ 'pkgmanager.cc', 'pkgrecords.cc', 'pkgsrcrecords.cc', 'policy.cc',
+ 'progress.cc', 'sourcelist.cc', 'string.cc', 'tag.cc']
+files = ['python/' + fname for fname in files]
apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"])
# The apt_inst module
-files = map(lambda source: "python/"+source,
- sorted(parse_makefile("python/makefile")["APT_INST_SRC"].split()))
+files = ["python/apt_instmodule.cc", "python/generic.cc", "python/tar.cc"]
apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"])
# Replace the leading _ that is used in the templates for translation
-templates = []
-
-# build doc
if len(sys.argv) > 1 and sys.argv[1] == "build":
if not os.path.exists("build/data/templates/"):
os.makedirs("build/data/templates")
for template in glob.glob('data/templates/*.info.in'):
source = open(template, "r")
- build = open(os.path.join("build", template[:-3]), "w")
- lines = source.readlines()
- for line in lines:
+ build = open("build/" + template[:-3], "w")
+ for line in source:
build.write(line.lstrip("_"))
source.close()
build.close()
-
-if len(sys.argv) > 1 and sys.argv[1] == "clean" and '-a' in sys.argv:
- for dirname in "build/doc", "doc/build", "build/data", "build/mo":
- if os.path.exists(dirname):
- print "Removing", dirname
- shutil.rmtree(dirname)
- else:
- print "Not removing", dirname, "because it does not exist"
-
setup(name="python-apt",
description="Python bindings for APT",
version=os.environ.get('DEBVER'),
@@ -56,20 +65,6 @@ setup(name="python-apt",
glob.glob('build/data/templates/*.info')),
('share/python-apt/templates',
glob.glob('data/templates/*.mirrors'))],
- cmdclass = {"build": build_extra.build_extra,
- "build_i18n": build_i18n.build_i18n},
+ cmdclass = cmdclass,
license = 'GNU GPL',
platforms = 'posix')
-
-if len(sys.argv) > 1 and sys.argv[1] == "build":
- import sphinx
- try:
- import pygtk
- except ImportError:
- print >> sys.stderr, ('W: Not building documentation because python-'
- 'gtk2 is not available at the moment.')
- 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",
- os.path.abspath("doc/source"), "build/doc/text"])
diff --git a/setup3.py b/setup3.py
deleted file mode 100644
index a3cbdc8e..00000000
--- a/setup3.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#! /usr/bin/env python3
-# $Id: setup.py,v 1.2 2002/01/08 07:13:21 jgg Exp $
-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
-
-
-# The apt_pkg module
-files = ["python/"+source for source in parse_makefile("python/makefile")["APT_PKG_SRC"].split()]
-apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"])
-
-# The apt_inst module
-files = ["python/"+source for source in parse_makefile("python/makefile")["APT_INST_SRC"].split()]
-apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"])
-
-# Replace the leading _ that is used in the templates for translation
-templates = []
-
-# build doc
-if len(sys.argv) > 1 and sys.argv[1] == "build":
- if not os.path.exists("build/data/templates/"):
- os.makedirs("build/data/templates")
- for template in glob.glob('data/templates/*.info.in'):
- source = open(template, "r")
- build = open(os.path.join("build", template[:-3]), "w")
- lines = source.readlines()
- for line in lines:
- build.write(line.lstrip("_"))
- source.close()
- build.close()
-
-
-if len(sys.argv) > 1 and sys.argv[1] == "clean" and '-a' in sys.argv:
- for dirname in "build/doc", "doc/build", "build/data", "build/mo":
- if os.path.exists(dirname):
- print("Removing", dirname)
- shutil.rmtree(dirname)
- else:
- print("Not removing", dirname, "because it does not exist")
-
-setup(name="python-apt",
- description="Python bindings for APT",
- version=os.environ.get('DEBVER'),
- author="APT Development Team",
- author_email="deity@lists.debian.org",
- ext_modules=[apt_pkg, apt_inst],
- packages=['apt', 'apt.progress', 'aptsources'],
- data_files = [('share/python-apt/templates',
- glob.glob('build/data/templates/*.info')),
- ('share/python-apt/templates',
- glob.glob('data/templates/*.mirrors'))],
-# cmdclass = {"build": build_extra.build_extra,
-# "build_i18n": build_i18n.build_i18n},
- license = 'GNU GPL',
- platforms = 'posix')
-
-if len(sys.argv) > 1 and sys.argv[1] == "build":
- try:
- import sphinx
- except ImportError:
- print(('W: Sphinx not available - Not building'
- 'documentation'), file=sys.stderr)
- try:
- import pygtk
- except ImportError:
- print(('W: Not building documentation because python-'
- 'gtk2 is not available at the moment.'), file=sys.stderr)
- 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",
- os.path.abspath("doc/source"), "build/doc/text"])