diff --git a/docs/conf.py b/docs/conf.py index ac520769..f1f32a01 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,7 +52,9 @@ master_doc = 'index' # General information about the project. project = 'ocrmypdf' -copyright = '2018, James R. Barlow. Licensed under Creative Commons Attribution-ShareAlike 4.0.' +copyright = ( + '2019, James R. Barlow. Licensed under Creative Commons Attribution-ShareAlike 4.0.' +) author = 'James R. Barlow' # The version info for the project you're documenting, acts as replacement for @@ -62,6 +64,7 @@ author = 'James R. Barlow' # The short X.Y version. import os + on_rtd = os.environ.get('READTHEDOCS') == 'True' if on_rtd: @@ -78,18 +81,16 @@ if on_rtd: 'pikepdf', 'pikepdf.models', 'pikepdf.models.metadata', - 'ocrmypdf.leptonica' + 'ocrmypdf.leptonica', ] sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) -from ocrmypdf import __version__ as OCRMYPDF_VERSION +from pkg_resources import get_distribution, DistributionNotFound -_version_parts = OCRMYPDF_VERSION.split('.') - -version = '.'.join(_version_parts[0:2]) # The full version, including alpha/beta/rc tags. -release = OCRMYPDF_VERSION +release = get_distribution('ocrmypdf').version +version = '.'.join(release.split('.')[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -158,9 +159,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # further. For a list of options available for each theme, see the # documentation. # -html_theme_options = { - 'display_version': False -} +html_theme_options = {'display_version': False} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] @@ -273,29 +272,25 @@ htmlhelp_basename = 'ocrmypdfdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'ocrmypdf.tex', 'ocrmypdf Documentation', - 'James R. Barlow', 'manual'), + (master_doc, 'ocrmypdf.tex', 'ocrmypdf Documentation', 'James R. Barlow', 'manual') ] # The name of an image file (relative to this directory) to place at the top of @@ -335,10 +330,7 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'ocrmypdf', 'ocrmypdf Documentation', - [author], 1) -] +man_pages = [(master_doc, 'ocrmypdf', 'ocrmypdf Documentation', [author], 1)] # If true, show URL addresses after external links. # @@ -351,9 +343,15 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'ocrmypdf', 'ocrmypdf Documentation', - author, 'ocrmypdf', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + 'ocrmypdf', + 'ocrmypdf Documentation', + author, + 'ocrmypdf', + 'One line description of project.', + 'Miscellaneous', + ) ] # Documents to append as an appendix to all manuals.