-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc: Allow building documentation even without a compiled extension
This involves a fake _ldap module and carefully bootstrapping ldap.__init__ (which imports * from _ldap).
- Loading branch information
Petr Viktorin
committed
Nov 27, 2017
1 parent
1bb84f6
commit e34bd6b
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| """ | ||
| A module that mocks `_ldap` for the purposes of generating documentation | ||
| This module provides placeholders for the contents of `_ldap`, making it | ||
| possible to generate documentation even _ldap is not compiled. | ||
| It should also make the documentation independent of which features are | ||
| available in the system OpenLDAP library. | ||
| The overly long module name will show up in AttributeError messages, | ||
| hinting that this is not the actual _ldap. | ||
| See https://www.python-ldap.org/ for details. | ||
| """ | ||
|
|
||
| import sys | ||
|
|
||
| # Cause `import _ldap` to import this module instead of the actual `_ldap`. | ||
| sys.modules['_ldap'] = sys.modules[__name__] | ||
|
|
||
| from constants import CONSTANTS | ||
| from pkginfo import __version__ | ||
|
|
||
| for constant in CONSTANTS: | ||
| globals()[constant.name] = constant | ||
|
|
||
| def get_option(num): | ||
| pass | ||
|
|
||
| class LDAPError: | ||
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters