summaryrefslogtreecommitdiff
path: root/setup3.py
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-04-15 20:29:30 +0200
committerJulian Andres Klode <jak@debian.org>2009-04-15 20:29:30 +0200
commit49c10e3b9f6760280761f1255f3182637ba0ac9e (patch)
tree611819fece2da28d796b184457fb413f1f7b497d /setup3.py
parent23d29169c30b2f05a0c2943832a7cf7288ff5802 (diff)
parentabc7c861e85265b0725aa82a51fe41f9183bc506 (diff)
downloadpython-apt-49c10e3b9f6760280761f1255f3182637ba0ac9e.tar.gz
python-apt (0.7.90) experimental; urgency=low
* Introduce support for Python 3 (Closes: #523645) * Support the 'in' operator (e.g. "k in d") in Configuration{,Ptr,Sub} objects (e.g. apt_pkg.Config) and in TagSections (apt_pkg.ParseSection()) * Replace support for file objects with a more generic support for any object providing a fileno() method and for file descriptors (integers). * Add support for the Breaks fields * Only create Package objects when they are requested, do not keep them in a dict. Saves 10MB for 25,000 packages on my machine. * apt/package.py: Allow to set the candidate of a package (Closes: #523997) - Support assignments to the 'candidate' property of Package objects. - Initial patch by Sebastian Heinlein -- Julian Andres Klode <jak@debian.org> Wed, 15 Apr 2009 13:47:42 +0200
Diffstat (limited to 'setup3.py')
-rw-r--r--setup3.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/setup3.py b/setup3.py
new file mode 100644
index 00000000..a3cbdc8e
--- /dev/null
+++ b/setup3.py
@@ -0,0 +1,77 @@
+#! /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"])