summaryrefslogtreecommitdiff
path: root/doc/source/conf.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/conf.py')
-rw-r--r--doc/source/conf.py65
1 files changed, 44 insertions, 21 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 40154a6f..5f82d5eb 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -16,20 +16,27 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
+import glob
import sys
-# If your extensions are in another directory, add it here. If the directory
-# is relative to the documentation root, use os.path.abspath to make it
-# 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'):
- if version in dirname:
- sys.path.insert(0, os.path.abspath('../../build/' + dirname))
+ for apt_pkg_path in glob.glob('../../build/lib*%s/*.so' % version):
+ sys.path.insert(0, os.path.abspath(os.path.dirname(apt_pkg_path)))
+ try:
+ import apt_pkg
+ except ImportError, exc:
+ # Not the correct version
+ sys.stderr.write('W: Ignoring error %s\n' % exc)
+ sys.path.pop(0)
+ else:
+ sys.stdout.write('I: Found apt_pkg.so in %s\n' % sys.path[0])
+ # Hack: Disable compatibility mode
+ apt_pkg._COMPAT_0_7 = 0
+ break
+
+
# General configuration
# ---------------------
@@ -41,7 +48,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
intersphinx_mapping = {'http://docs.python.org/': None}
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['.templates']
+templates_path = ['templates']
# The suffix of source filenames.
source_suffix = '.rst'
@@ -50,23 +57,39 @@ source_suffix = '.rst'
#source_encoding = 'utf-8'
# The master toctree document.
-master_doc = 'index'
+#master_doc = 'contents'
# General information about the project.
project = u'python-apt'
-copyright = u'2009, Julian Andres Klode <jak@debian.org>'
+copyright = u'2009-2010, Julian Andres Klode <jak@debian.org>'
# The version info for the project you're documenting, acts as replacement for
# |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 = '.'.join(changes.full_version.split('.')[:2])
-# The full version, including alpha/beta/rc tags.
-release = changes.full_version
+try:
+ release=os.environ['DEBVER']
+except KeyError:
+ from subprocess import Popen, PIPE
+ p1 = Popen(["dpkg-parsechangelog", "-l../../debian/changelog"],
+ stdout=PIPE)
+ p2 = Popen(["sed", "-n", 's/^Version: //p'], stdin=p1.stdout, stdout=PIPE)
+ release = p2.communicate()[0]
+
+# Handle the alpha release scheme
+if int(release.split("~")[0].split(".")[2]) >= 90:
+ version_s = release.split("~")[0].split(".")[:3]
+ # Set the version to 0.X.100 if the release is 0.X.9Y (0.7.90 => 0.7.100)
+ # Use
+ # version_s[1] = str(int(version_s[1]) + 1)
+ # version_s[2] = "0"
+ # if the version of a 0.X.9Y release should be 0.X+1.0 (0.7.90=>0.8)
+ version_s[2] = "100"
+ version = '.'.join(version_s)
+ del version_s
+else:
+ version = '.'.join(release.split("~")[0].split('.')[:3])
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -134,7 +157,7 @@ html_static_path = ['.static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@@ -145,7 +168,7 @@ html_static_path = ['.static']
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+html_additional_pages = {"index": "indexcontent.html"}
# If false, no module index is generated.
#html_use_modindex = True
@@ -183,7 +206,7 @@ htmlhelp_basename = 'python-aptdoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source index, target name, title, author, document class [howto/manual]).
latex_documents = [
- ('index', 'python-apt.tex', ur'python-apt Documentation',
+ ('contents', 'python-apt.tex', ur'python-apt Documentation',
ur'Julian Andres Klode <jak@debian.org>', 'manual'),
]