Commit ae260583 authored by André Anjos's avatar André Anjos 💬 Committed by Samuel GAIST

Externalize version number for re-use by build system; Sphinx is a doc-build dep only

parent 2ecc2a23
include LICENSE.AGPL README.rst buildout.cfg bootstrap-buildout.py include LICENSE.AGPL README.rst buildout.cfg
recursive-include doc conf.py *.rst *.png *.svg *.ico recursive-include doc conf.py *.rst *.png *.svg *.ico
#!/usr/bin/env python #!/usr/bin/env python
# vim: set fileencoding=utf-8 : # vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.backend.python module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
import os import os
import sys import sys
import glob import glob
import pkg_resources import pkg_resources
# 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.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ----------------------------------------------------- # -- General configuration -----------------------------------------------------
...@@ -43,29 +15,48 @@ needs_sphinx = '1.3' ...@@ -43,29 +15,48 @@ needs_sphinx = '1.3'
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [ extensions = [
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx.ext.coverage', 'sphinx.ext.coverage',
'sphinx.ext.pngmath',
'sphinx.ext.ifconfig', 'sphinx.ext.ifconfig',
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'sphinx.ext.autosummary', 'sphinx.ext.autosummary',
'sphinx.ext.doctest', 'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.graphviz', 'sphinx.ext.graphviz',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon', 'sphinx.ext.napoleon',
'sphinx.ext.viewcode', 'sphinx.ext.viewcode',
'sphinx.ext.mathjax',
#'matplotlib.sphinxext.plot_directive'
] ]
# Be picky about warnings
nitpicky = True
# Ignores stuff we can't easily resolve on other project's sphinx manuals
nitpick_ignore = []
# Allows the user to override warnings from a separate file
if os.path.exists('nitpick-exceptions.txt'):
for line in open('nitpick-exceptions.txt'):
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
try: # python 2.x
target = unicode(target)
except NameError:
pass
nitpick_ignore.append((dtype, target))
# Always includes todos # Always includes todos
todo_include_todos = True todo_include_todos = True
# Create numbers on figures with captions
numfig = True
# Generates auto-summary automatically # Generates auto-summary automatically
autosummary_generate = True autosummary_generate = True
# Create numbers on figures with captions
numfig = True
# If we are on OSX, the 'dvipng' path maybe different # If we are on OSX, the 'dvipng' path maybe different
dvipng_osx = '/opt/local/libexec/texlive/binaries/dvipng' dvipng_osx = '/opt/local/libexec/texlive/binaries/dvipng'
if os.path.exists(dvipng_osx): pngmath_dvipng = dvipng_osx if os.path.exists(dvipng_osx): pngmath_dvipng = dvipng_osx
...@@ -111,10 +102,7 @@ release = distribution.version ...@@ -111,10 +102,7 @@ release = distribution.version
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
exclude_patterns = [ exclude_patterns = ['links.rst']
'api/modules.rst',
'api/beat.rst',
]
# The reST default role (used for this markup: `text`) to use for all documents. # The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None #default_role = None
...@@ -138,7 +126,7 @@ pygments_style = 'sphinx' ...@@ -138,7 +126,7 @@ pygments_style = 'sphinx'
# Some variables which are useful for generated material # Some variables which are useful for generated material
project_variable = project.replace('.', '_') project_variable = project.replace('.', '_')
short_description = u'Biometrics Evaluation and Testing Platform (Core Modules)' short_description = u'Biometrics Evaluation and Testing Platform (Python backend)'
owner = [u'Idiap Research Institute'] owner = [u'Idiap Research Institute']
...@@ -166,12 +154,12 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] ...@@ -166,12 +154,12 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name of an image file (relative to this directory) to place at the top # The name of an image file (relative to this directory) to place at the top
# of the sidebar. # of the sidebar.
#html_logo = 'img/beat.svg' html_logo = 'img/logo.png'
# The name of an image file (within the static path) to use as favicon of the # The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large. # pixels large.
html_favicon = 'img/beat.ico' html_favicon = 'img/favicon.ico'
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
...@@ -223,67 +211,15 @@ html_favicon = 'img/beat.ico' ...@@ -223,67 +211,15 @@ html_favicon = 'img/beat.ico'
htmlhelp_basename = project_variable + u'_doc' htmlhelp_basename = project_variable + u'_doc'
# -- Options for LaTeX output -------------------------------------------------- # -- Post configuration --------------------------------------------------------
# The paper size ('letter' or 'a4').
latex_paper_size = 'a4'
# The font size ('10pt', '11pt' or '12pt').
latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [(
'index',
project_variable + '.tex',
short_description,
owner[0],
'manual',
)]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = ''
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# Included after all input documents # Included after all input documents
rst_epilog = """ rst_epilog = """
.. |project| replace:: BEAT .. |project| replace:: Bob
.. |url| replace:: https://www.beat-eu.org/platform/
.. |version| replace:: %s .. |version| replace:: %s
.. |current-year| date:: %%Y .. |current-year| date:: %%Y
""" % (version,) """ % (version,)
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(
'index',
project_variable,
short_description,
owner,
1,
)]
# Default processing flags for sphinx # Default processing flags for sphinx
autoclass_content = 'class' autoclass_content = 'class'
autodoc_member_order = 'bysource' autodoc_member_order = 'bysource'
...@@ -293,13 +229,34 @@ autodoc_default_flags = [ ...@@ -293,13 +229,34 @@ autodoc_default_flags = [
'show-inheritance', 'show-inheritance',
] ]
python_version = '.'.join(str(k) for k in sys.version_info[0:2]) # For inter-documentation mapping:
python_link = 'http://docs.python.org/' + python_version + '/' from bob.extension.utils import link_documentation, load_requirements
numpy_link = 'http://docs.scipy.org/doc/numpy/' sphinx_requirements = "extra-intersphinx.txt"
intersphinx_mapping = dict( if os.path.exists(sphinx_requirements):
python=(python_link, None), intersphinx_mapping = link_documentation(
numpy=(numpy_link, None), additional_packages=['python','numpy'] + \
) load_requirements(sphinx_requirements)
)
else:
intersphinx_mapping = link_documentation()
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = ['__array__']
def member_function_test(app, what, name, obj, skip, options):
# test if we have a private function
if len(name) > 1 and name[0] == '_':
# test if this private function should be allowed
if name not in accepted_private_functions:
# omit privat functions that are not in the list of accepted private functions
return skip
else:
# test if the method is documented
if not hasattr(obj, '__doc__') or not obj.__doc__:
return skip
return False
def setup(app): def setup(app):
pass app.connect('autodoc-skip-member', member_function_test)
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
# # # #
############################################################################### ###############################################################################
# Define package version
version = open("version.txt").read().rstrip()
from setuptools import setup, find_packages from setuptools import setup, find_packages
...@@ -33,7 +35,7 @@ from setuptools import setup, find_packages ...@@ -33,7 +35,7 @@ from setuptools import setup, find_packages
setup( setup(
name='beat.backend.python', name='beat.backend.python',
version='1.4.2', version=version,
description='Biometrics Evaluation and Testing Platform (Python backend)', description='Biometrics Evaluation and Testing Platform (Python backend)',
url='https://gitlab.idiap.ch/beat/beat.backend.python', url='https://gitlab.idiap.ch/beat/beat.backend.python',
license='AGPLv3', license='AGPLv3',
...@@ -46,13 +48,6 @@ setup( ...@@ -46,13 +48,6 @@ setup(
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
namespace_packages=[
"beat",
"beat.backend",
"beat.backend.python",
"beat.backend.python.test",
],
install_requires=[ install_requires=[
"docopt", "docopt",
"numpy", "numpy",
...@@ -60,7 +55,6 @@ setup( ...@@ -60,7 +55,6 @@ setup(
"setuptools", "setuptools",
"simplejson", "simplejson",
"six", "six",
"sphinx",
"pyzmq", "pyzmq",
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment