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