Skip to content

Commit 4431a30

Browse files
authored
Merge pull request #11 – Build documentation without the compiled extension
#11
2 parents a72aaac + 5cbbc49 commit 4431a30

18 files changed

+1114
-751
lines changed

Doc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/_build

Doc/conf.py

Lines changed: 143 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,143 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# python-ldap documentation build configuration file, created by
4-
# sphinx-quickstart on Sat Mar 29 15:08:17 2008.
5-
#
6-
# This file is execfile()d with the current directory set to its containing dir.
7-
#
8-
# The contents of this file are pickled, so don't put values in the namespace
9-
# that aren't pickleable (module imports are okay, they're removed automatically).
10-
#
11-
# All configuration values have a default value; values that are commented out
12-
# serve to show the default value.
13-
14-
import sys
15-
16-
# If your extensions are in another directory, add it here.
17-
#sys.path.append('some/directory')
18-
19-
# General configuration
20-
# ---------------------
21-
22-
# Add any Sphinx extension module names here, as strings. They can be extensions
23-
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
24-
extensions = ['sphinx.ext.autodoc']
25-
26-
# Add any paths that contain templates here, relative to this directory.
27-
templates_path = ['.templates']
28-
29-
# The suffix of source filenames.
30-
source_suffix = '.rst'
31-
32-
# The master toctree document.
33-
master_doc = 'index'
34-
35-
# General substitutions.
36-
project = 'python-ldap'
37-
copyright = '2008-2017, python-ldap project team'
38-
39-
# The default replacements for |version| and |release|, also used in various
40-
# other places throughout the built documents.
41-
#
42-
# The short X.Y version.
43-
version = '2.5'
44-
# The full version, including alpha/beta/rc tags.
45-
release = '2.5.2.0'
46-
47-
# There are two options for replacing |today|: either, you set today to some
48-
# non-false value, then it is used:
49-
#today = ''
50-
# Else, today_fmt is used as the format for a strftime call.
51-
today_fmt = '%B %d, %Y'
52-
53-
# List of documents that shouldn't be included in the build.
54-
#unused_docs = []
55-
56-
# If true, '()' will be appended to :func: etc. cross-reference text.
57-
#add_function_parentheses = True
58-
59-
# If true, the current module name will be prepended to all description
60-
# unit titles (such as .. function::).
61-
#add_module_names = True
62-
63-
# If true, sectionauthor and moduleauthor directives will be shown in the
64-
# output. They are ignored by default.
65-
#show_authors = False
66-
67-
# The name of the Pygments (syntax highlighting) style to use.
68-
pygments_style = 'sphinx'
69-
70-
71-
# Options for HTML output
72-
# -----------------------
73-
74-
# The style sheet to use for HTML and HTML Help pages. A file of that name
75-
# must exist either in Sphinx' static/ path, or in one of the custom paths
76-
# given in html_static_path.
77-
html_style = 'pyramid.css'
78-
79-
# Add any paths that contain custom static files (such as style sheets) here,
80-
# relative to this directory. They are copied after the builtin static files,
81-
# so a file named "default.css" will overwrite the builtin "default.css".
82-
html_static_path = ['/usr/lib/python2.7/site-packages/sphinx/themes/pyramid/static']
83-
84-
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
85-
# using the given strftime format.
86-
html_last_updated_fmt = '%b %d, %Y'
87-
88-
# If true, SmartyPants will be used to convert quotes and dashes to
89-
# typographically correct entities.
90-
#html_use_smartypants = True
91-
92-
# Content template for the index page.
93-
#html_index = ''
94-
95-
# Custom sidebar templates, maps document names to template names.
96-
#html_sidebars = {}
97-
98-
# Additional templates that should be rendered to pages, maps page names to
99-
# template names.
100-
#html_additional_pages = {}
101-
102-
# If false, no module index is generated.
103-
html_use_modindex = True
104-
105-
# If true, the reST sources are included in the HTML build as _sources/<name>.
106-
#html_copy_source = True
107-
108-
# Output file base name for HTML help builder.
109-
htmlhelp_basename = 'python-ldap-doc'
110-
111-
112-
# Options for LaTeX output
113-
# ------------------------
114-
115-
# The paper size ('letter' or 'a4').
116-
#latex_paper_size = 'letter'
117-
118-
# The font size ('10pt', '11pt' or '12pt').
119-
#latex_font_size = '10pt'
120-
121-
# Grouping the document tree into LaTeX files. List of tuples
122-
# (source start file, target name, title, author, document class [howto/manual]).
123-
latex_documents = [('index', 'python-ldap.tex', 'python-ldap Documentation',
124-
'python-ldap project', 'manual')]
125-
126-
# Additional stuff for the LaTeX preamble.
127-
#latex_preamble = ''
128-
129-
# Documents to append as an appendix to all manuals.
130-
#latex_appendices = []
131-
132-
# If false, no module index is generated.
133-
latex_use_modindex = True
1+
# -*- coding: utf-8 -*-
2+
#
3+
# python-ldap documentation build configuration file, created by
4+
# sphinx-quickstart on Sat Mar 29 15:08:17 2008.
5+
#
6+
# This file is execfile()d with the current directory set to its containing dir.
7+
#
8+
# The contents of this file are pickled, so don't put values in the namespace
9+
# that aren't pickleable (module imports are okay, they're removed automatically).
10+
#
11+
# All configuration values have a default value; values that are commented out
12+
# serve to show the default value.
13+
14+
import sys
15+
import os
16+
17+
# If your extensions are in another directory, add it here.
18+
_doc_dir = os.path.dirname(__file__)
19+
sys.path.append(_doc_dir)
20+
sys.path.append(os.path.join(_doc_dir, '../Lib/'))
21+
sys.path.insert(0, os.path.join(_doc_dir, '../Lib/ldap'))
22+
23+
# Import fake `_ldap` module
24+
import fake_ldap_module_for_documentation
25+
26+
# Now ldap can be used normally
27+
from ldap import __version__
28+
29+
# General configuration
30+
# ---------------------
31+
32+
# Add any Sphinx extension module names here, as strings. They can be extensions
33+
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
34+
extensions = ['sphinx.ext.autodoc']
35+
36+
# Add any paths that contain templates here, relative to this directory.
37+
templates_path = ['.templates']
38+
39+
# The suffix of source filenames.
40+
source_suffix = '.rst'
41+
42+
# The master toctree document.
43+
master_doc = 'index'
44+
45+
# General substitutions.
46+
project = 'python-ldap'
47+
copyright = '2008-2017, python-ldap project team'
48+
49+
# The default replacements for |version| and |release|, also used in various
50+
# other places throughout the built documents.
51+
#
52+
# The short X.Y version.
53+
version = '.'.join(__version__.split('.')[:2])
54+
# The full version, including alpha/beta/rc tags.
55+
release = __version__
56+
57+
# There are two options for replacing |today|: either, you set today to some
58+
# non-false value, then it is used:
59+
#today = ''
60+
# Else, today_fmt is used as the format for a strftime call.
61+
today_fmt = '%B %d, %Y'
62+
63+
# List of documents that shouldn't be included in the build.
64+
#unused_docs = []
65+
66+
# If true, '()' will be appended to :func: etc. cross-reference text.
67+
#add_function_parentheses = True
68+
69+
# If true, the current module name will be prepended to all description
70+
# unit titles (such as .. function::).
71+
#add_module_names = True
72+
73+
# If true, sectionauthor and moduleauthor directives will be shown in the
74+
# output. They are ignored by default.
75+
#show_authors = False
76+
77+
# The name of the Pygments (syntax highlighting) style to use.
78+
pygments_style = 'sphinx'
79+
80+
81+
# Options for HTML output
82+
# -----------------------
83+
84+
# The style sheet to use for HTML and HTML Help pages. A file of that name
85+
# must exist either in Sphinx' static/ path, or in one of the custom paths
86+
# given in html_static_path.
87+
#html_style = 'pyramid.css'
88+
89+
# Add any paths that contain custom static files (such as style sheets) here,
90+
# relative to this directory. They are copied after the builtin static files,
91+
# so a file named "default.css" will overwrite the builtin "default.css".
92+
#html_static_path = ['/usr/lib/python2.7/site-packages/sphinx/themes/pyramid/static']
93+
94+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
95+
# using the given strftime format.
96+
html_last_updated_fmt = '%b %d, %Y'
97+
98+
# If true, SmartyPants will be used to convert quotes and dashes to
99+
# typographically correct entities.
100+
#html_use_smartypants = True
101+
102+
# Content template for the index page.
103+
#html_index = ''
104+
105+
# Custom sidebar templates, maps document names to template names.
106+
#html_sidebars = {}
107+
108+
# Additional templates that should be rendered to pages, maps page names to
109+
# template names.
110+
#html_additional_pages = {}
111+
112+
# If false, no module index is generated.
113+
html_use_modindex = True
114+
115+
# If true, the reST sources are included in the HTML build as _sources/<name>.
116+
#html_copy_source = True
117+
118+
# Output file base name for HTML help builder.
119+
htmlhelp_basename = 'python-ldap-doc'
120+
121+
122+
# Options for LaTeX output
123+
# ------------------------
124+
125+
# The paper size ('letter' or 'a4').
126+
#latex_paper_size = 'letter'
127+
128+
# The font size ('10pt', '11pt' or '12pt').
129+
#latex_font_size = '10pt'
130+
131+
# Grouping the document tree into LaTeX files. List of tuples
132+
# (source start file, target name, title, author, document class [howto/manual]).
133+
latex_documents = [('index', 'python-ldap.tex', 'python-ldap Documentation',
134+
'python-ldap project', 'manual')]
135+
136+
# Additional stuff for the LaTeX preamble.
137+
#latex_preamble = ''
138+
139+
# Documents to append as an appendix to all manuals.
140+
#latex_appendices = []
141+
142+
# If false, no module index is generated.
143+
latex_use_modindex = True
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
A module that mocks `_ldap` for the purposes of generating documentation
3+
4+
This module provides placeholders for the contents of `_ldap`, making it
5+
possible to generate documentation even _ldap is not compiled.
6+
It should also make the documentation independent of which features are
7+
available in the system OpenLDAP library.
8+
9+
The overly long module name will show up in AttributeError messages,
10+
hinting that this is not the actual _ldap.
11+
12+
See https://www.python-ldap.org/ for details.
13+
"""
14+
15+
import sys
16+
17+
# Cause `import _ldap` to import this module instead of the actual `_ldap`.
18+
sys.modules['_ldap'] = sys.modules[__name__]
19+
20+
from constants import CONSTANTS
21+
from pkginfo import __version__
22+
23+
for constant in CONSTANTS:
24+
globals()[constant.name] = constant
25+
26+
def get_option(num):
27+
pass
28+
29+
class LDAPError:
30+
pass

0 commit comments

Comments
 (0)