summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
commit38d602dc83006c51dfe4ed594d691ea9b0679498 (patch)
treeb7aedfba82c44cad6c3012f879b5d6d7e8ad1425 /setup.py
parent12cf58d12b969010f3d98b2974d72bbb950b775f (diff)
parent614897f798d9f16591fbd29ebe2a6c5674102d2d (diff)
downloadpython-apt-38d602dc83006c51dfe4ed594d691ea9b0679498.tar.gz
* apt/*.py:
- Almost complete cleanup of the code - Remove inconsistent use of tabs and spaces (Closes: #505443) - Improved documentation * apt/debfile.py: - Drop get*() methods, as they are deprecated and were never in a stable release - Make DscSrcPackage working * apt/gtk/widgets.py: - Fix the code and document the signals * Introduce new documentation build with Sphinx - Contains style Guide (Closes: #481562) - debian/rules: Build the documentation here - setup.py: Remove pydoc building and add new docs. - debian/examples: Include examples from documentation - debian/python-apt.docs: + Change html/ to build/doc/html. + Add build/doc/text for the text-only documentation * setup.py: - Only create build/data when building, not all the time - Remove build/mo and build/data on clean -a * debian/control: - Remove the Conflicts on python2.3-apt, python2.4-apt, as they are only needed for oldstable (sarge) - Build-Depend on python-sphinx (>= 0.5) * aptsources/distinfo.py: - Allow @ in mirror urls (Closes: #478171) (LP: #223097) * Merge Ben Finney's whitespace changes (Closes: #481563) * Merge Ben Finney's do not use has_key() (Closes: #481878) * Do not use deprecated form of raise statement (Closes: #494259) * Add support for PkgRecords.SHA256Hash (Closes: #456113)
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py81
1 files changed, 38 insertions, 43 deletions
diff --git a/setup.py b/setup.py
index 7024f81e..6a22734d 100755
--- a/setup.py
+++ b/setup.py
@@ -3,72 +3,67 @@
from distutils.core import setup, Extension
from distutils.sysconfig import parse_makefile
-from DistUtilsExtra.command import *
+from DistUtilsExtra.command import build_extra, build_i18n
import glob
import os
-import os.path
-import pydoc
import shutil
-import string
import sys
-def build_docs(dir="html", modules=["apt","aptsources"]):
- htmldir = os.path.join(os.getcwd(), dir)
- for d in modules:
- for (dirpath, dirnames, filenames) in os.walk(d):
- pydoc.writedoc(dirpath.replace("/","."))
- for file in filenames:
- if not file.endswith(".py"):
- continue
- if file in ["__init__.py"]:
- continue
- pydoc.writedoc(dirpath.replace("/",".")+"."+file.split(".py")[0])
- if not os.path.exists(htmldir):
- os.mkdir(htmldir)
- for f in glob.glob("*.html"):
- shutil.move(f, htmldir)
- return True
# The apt_pkg module
files = map(lambda source: "python/"+source,
- string.split(parse_makefile("python/makefile")["APT_PKG_SRC"]))
-apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]);
+ parse_makefile("python/makefile")["APT_PKG_SRC"].split())
+apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"])
# The apt_inst module
files = map(lambda source: "python/"+source,
- string.split(parse_makefile("python/makefile")["APT_INST_SRC"]))
-apt_inst = Extension("apt_inst", files, libraries=["apt-pkg","apt-inst"]);
+ 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 = []
-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()
# build doc
-if sys.argv[1] == "build":
- build_docs()
+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()
-setup(name="python-apt",
- version="0.6.17",
+
+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",
+ version="0.7.9",
description="Python bindings for APT",
author="APT Development Team",
author_email="deity@lists.debian.org",
- ext_modules=[apt_pkg,apt_inst],
+ ext_modules=[apt_pkg, apt_inst],
packages=['apt', 'apt.gtk', '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 },
+ cmdclass = {"build": build_extra.build_extra,
+ "build_i18n": build_i18n.build_i18n},
license = 'GNU GPL',
- platforms = 'posix'
- )
+ platforms = 'posix')
+
+if len(sys.argv) > 1 and sys.argv[1] == "build":
+ import sphinx
+ 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"])