Skip to content

Commit

Permalink
Read version from VERSION file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtv committed Dec 8, 2017
1 parent e78bad1 commit 0c9df05
Showing 1 changed file with 43 additions and 25 deletions.
68 changes: 43 additions & 25 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# -*- coding: utf-8 -*-
#
# libpqxx documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 3 00:43:33 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
"""
libpqxx documentation build configuration file, created by
sphinx-quickstart on Sun Dec 3 00:43:33 2017.
This file is execfile()d with the current directory set to its containing dir.
All configuration values have a default; values that are commented out serve
to show the default.
"""

import codecs
import os
import subprocess


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import sys
# sys.path.insert(0, os.path.abspath(os.path.curdir))

import os
import subprocess

read_the_docs_build = os.environ.get('READTHEDOCS') == 'True'

if read_the_docs_build:
subprocess.check_call('./configure', cwd=os.path.pardir)
subprocess.check_call(
os.path.join(os.path.curdir, 'configure'), cwd=os.path.pardir)
subprocess.check_call('doxygen', cwd=os.path.join(os.path.pardir, 'doc'))

# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -53,17 +57,27 @@

# General information about the project.
project = u'libpqxx'
copyright = u'2017, jtv'
author = u'jtv'
copyright = u'2017, Jeroen T. Vermeulen'
author = u'Jeroen T. Vermeulen'


def read_version():
"""Return version number as specified in the VERSION file."""
version_file = os.path.join(
os.path.dirname(__file__), os.path.pardir, 'VERSION')
with codecs.open(version_file, encoding='ascii') as stream:
return stream.read().strip()


# 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.
#
# The short X.Y version.
version = u''
# The full version, including alpha/beta/rc tags.
release = u''
release = read_version()

# The short X.Y version.
version = release

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -146,8 +160,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'libpqxx.tex', u'libpqxx Documentation',
u'jtv', 'manual'),
(
master_doc,
'libpqxx.tex',
u'libpqxx Documentation',
u'Jeroen T. Vermeulen',
'manual',
),
]


Expand All @@ -156,8 +175,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'libpqxx', u'libpqxx Documentation',
[author], 1)
(master_doc, 'libpqxx', u'libpqxx Documentation', [author], 1)
]


Expand All @@ -168,6 +186,6 @@
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'libpqxx', u'libpqxx Documentation',
author, 'libpqxx', 'One line description of project.',
author, 'libpqxx', "C++ client API for PostgreSQL.",
'Miscellaneous'),
]

0 comments on commit 0c9df05

Please sign in to comment.