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