diff -r d767ac371ee3 doc/sphinx/source/conf.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/sphinx/source/conf.py Fri Jul 06 11:24:08 2018 -0400
@@ -0,0 +1,163 @@
+# -*- coding: utf-8 -*-
+#
+# Configuration file for the Sphinx documentation builder.
+#
+# This file does only contain a selection of the most common options. For a
+# full list see the documentation:
+# http://www.sphinx-doc.org/en/master/config
+
+# -- Path setup --------------------------------------------------------------
+
+# 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 os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+
+
+# -- Project information -----------------------------------------------------
+
+project = 'python-nss'
+copyright = '2018, John Dennis'
+author = 'John Dennis'
+
+# The short X.Y version
+version = ''
+# The full version, including alpha/beta/rc tags
+release = ''
+
+
+# -- General configuration ---------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.autosummary',
+]
+
+autodoc_default_flags = ['members']
+autosummary_generate = True
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+#
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path .
+exclude_patterns = []
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# -- Options for HTML output -------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = 'alabaster'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#
+# html_theme_options = {}
+
+# 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,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Custom sidebar templates, must be a dictionary that maps document names
+# to template names.
+#
+# The default sidebars (for documents that don't match any pattern) are
+# defined by theme itself. Builtin themes are using these templates by
+# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
+# 'searchbox.html']``.
+#
+# html_sidebars = {}
+
+
+# -- Options for HTMLHelp output ---------------------------------------------
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'python-nssdoc'
+
+
+# -- 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',
+}
+
+# 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, 'python-nss.tex', 'python-nss Documentation',
+ 'John Dennis', 'manual'),
+]
+
+
+# -- Options for manual page output ------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'python-nss', 'python-nss Documentation',
+ [author], 1)
+]
+
+
+# -- Options for Texinfo output ----------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'python-nss', 'python-nss Documentation',
+ author, 'python-nss', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+
+# -- Extension configuration -------------------------------------------------
diff -r d767ac371ee3 doc/sphinx/source/index.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/sphinx/source/index.rst Fri Jul 06 11:24:08 2018 -0400
@@ -0,0 +1,43 @@
+.. python-nss documentation master file, created by
+ sphinx-quickstart on Thu Jun 28 09:36:37 2018.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to python-nss's documentation!
+======================================
+
+Sub-modules
+===========
+
+The functionality of python-nss is implemented in several sub-modules.
+Each sub-module focuses on related functions, classes and data. The
+bulk of NSS functionality (e.g. general cryptography) appears in the
+`nss.nss` module. You can detailed information on the module, it's
+data, it's classes and functions by following the link to the
+sub-module in the table below. You can also use the `Index` in the
+next section to jump directly to a specific item.
+
+
+.. autosummary::
+ :toctree: generated
+
+ nss.io
+ nss.ssl
+ nss.nss
+ nss.error
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+.. automodule:: nss
+ :members:
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
diff -r d767ac371ee3 setup.py
--- a/setup.py Tue Feb 28 18:24:19 2017 -0500
+++ b/setup.py Fri Jul 06 11:24:08 2018 -0400
@@ -15,21 +15,25 @@
from distutils.util import subst_vars, change_root
from distutils.command.build_py import build_py as _build_py
from distutils.command.sdist import sdist as _sdist
+from sphinx.setup_command import BuildDoc as SphinxBuildDoc
+name = 'python-nss'
version = "1.0.1"
+release = version
doc_manifest = [
[['include README LICENSE* doc/ChangeLog',
'recursive-include doc *.py *.txt',
- 'prune doc/examples/pki'],
+ 'prune doc/examples/pki',
+ 'prune doc/sphinx'],
[('^doc/', '')], None],
[['recursive-include test run_tests setup_certs.py test_*.py util.py *.txt',
'prune test/pki'],
None , None],
[['recursive-include lib *.py *.txt',],
[('^lib/', '')] , 'examples'],
- [['recursive-include build/doc/html *'],
- [('^build/doc/', 'api/')], None],
+ [['recursive-include build/sphinx/html *'],
+ [('^build/sphinx/', 'api/')], None],
]
def update_version():
@@ -114,13 +118,13 @@
user_options = [('docdir=', 'd', "directory root for documentation"),
]
- def has_epydoc (self):
- if find_executable('epydoc'):
+ def has_sphinx (self):
+ if find_executable('sphinx-build'):
return True
else:
return False
- sub_commands = [('build_api_doc', has_epydoc),
+ sub_commands = [('build_sphinx', has_sphinx),
]
def initialize_options(self):
@@ -137,46 +141,15 @@
def run(self):
self.run_command('build')
+ # Add build directory to Python path so doc builder can import
+ # in-tree built modules
+ sys.path.insert(0, self.build_lib)
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
+ # Remove the build directory from Python path
+ del sys.path[0]
-class BuildApiDoc(Command):
- description = 'generate the API documentation'
- user_options = [('docdir=', 'd', "directory root for documentation"),
- ('action=', 'a', "epydoc action (html, latex, dvi, ps, pdf, check, pickle"),
- ('htmldir', 'H', "directory to locate the API HTML files under"),
- ]
-
- def initialize_options(self):
- self.build_base = None
- self.build_lib = None
- self.docdir = None
- self.action = None
- self.htmldir = None
-
- def finalize_options(self):
- self.set_undefined_options('build',
- ('build_base', 'build_base'),
- ('build_lib', 'build_lib'))
-
- if self.action is None:
- self.action = 'html'
-
- if self.docdir is None:
- if self.action == 'html':
- self.docdir = change_root(self.get_finalized_command('build_doc').docdir, 'html')
- else:
- self.docdir = self.get_finalized_command('build_doc').docdir
-
- def run(self):
- prog = find_executable('epydoc')
- pkg_dirs = [change_root(self.build_lib, pkg) for pkg in self.distribution.packages]
- cmd = [prog, '-v', '--%s' % self.action, '--docformat', 'restructuredtext', '-o', self.docdir]
- #if self.verbose: cmd.append('-v')
- cmd.extend(pkg_dirs)
- self.mkpath(self.docdir)
- spawn(cmd)
class InstallDoc(Command):
description = 'install documentation'
@@ -373,7 +346,7 @@
#bug_tracker = 'https://bugzilla.redhat.com/buglist.cgi?submit&component=python-nss&product=Fedora&classification=Fedora'
#bug_enter = 'https://bugzilla.redhat.com/enter_bug.cgi?component=python-nss&product=Fedora&classification=Fedora',
- setup(name = 'python-nss',
+ setup(name = name,
version = version,
description = 'Python bindings for Network Security Services (NSS) and Netscape Portable Runtime (NSPR)',
long_description = long_description,
@@ -393,12 +366,17 @@
package_dir = {'nss':'src'},
packages = ['nss'],
cmdclass = {'build_doc' : BuildDoc,
- 'build_api_doc' : BuildApiDoc,
+ 'build_sphinx' : SphinxBuildDoc,
'install_doc' : InstallDoc,
'build_py' : BuildPy,
'sdist' : SDist,
},
-
+ command_options={
+ 'build_sphinx': {
+ 'project': ('setup.py', name),
+ 'version': ('setup.py', version),
+ 'release': ('setup.py', release),
+ 'source_dir': ('setup.py', 'doc/sphinx/source')}},
)
return 0