fix python code index page.

The recent change to use a dlib/__init__.py file instead of the dlib.so file directly messed it up.
pull/2150/head
Davis King 4 years ago
parent 59b44849bd
commit f55a1a51a0

2
.gitignore vendored

@ -15,4 +15,4 @@ docs/docs/cache/
docs/docs/git-logs.xml
docs/docs/python/classes.txt
docs/docs/python/functions.txt
docs/docs/python/constants.txt

@ -1,32 +1,36 @@
from __future__ import print_function
import dlib
import _dlib_pybind11
import inspect
def print_element(name, fc, ff):
def print_element(name, fc, ff, fconstants):
isclass = inspect.isclass(eval(name))
ismodule = inspect.ismodule(eval(name))
isroutine = inspect.isroutine(eval(name))
if (isclass):
print("* :class:`{0}`".format(name), file=fc)
elif (not ismodule):
elif (isroutine):
print("* :func:`{0}`".format(name), file=ff)
elif (not ismodule):
print("* :const:`{0}`".format(name), file=fconstants)
def make_listing_files():
fc = open('classes.txt', 'w')
ff = open('functions.txt', 'w')
fconstants = open('constants.txt', 'w')
for obj in dir(dlib):
for obj in dir(_dlib_pybind11):
if obj[0] == '_':
continue
print_element('dlib.'+obj, fc, ff)
print_element('_dlib_pybind11.'+obj, fc, ff, fconstants)
for obj in dir(dlib.cuda):
for obj in dir(_dlib_pybind11.cuda):
if obj[0] == '_':
continue
print_element('dlib.cuda.'+obj, fc, ff)
print_element('_dlib_pybind11.cuda.'+obj, fc, ff, fconstants)
for obj in dir(dlib.image_dataset_metadata):
for obj in dir(_dlib_pybind11.image_dataset_metadata):
if obj[0] == '_':
continue
print_element('dlib.image_dataset_metadata.'+obj, fc, ff)
print_element('_dlib_pybind11.image_dataset_metadata.'+obj, fc, ff, fconstants)

@ -20,6 +20,11 @@ Functions
.. include:: functions.txt
Constants
==============================================
.. include:: constants.txt
Detailed API Listing
==============================================
@ -27,15 +32,15 @@ Detailed API Listing
.. toctree::
:maxdepth: 2
.. automodule:: dlib
.. automodule:: _dlib_pybind11
:members:
:undoc-members:
.. automodule:: dlib.cuda
.. automodule:: _dlib_pybind11.cuda
:members:
:undoc-members:
.. automodule:: dlib.image_dataset_metadata
.. automodule:: _dlib_pybind11.image_dataset_metadata
:members:
:undoc-members:

@ -141,6 +141,11 @@ makedocs ()
cd ..
python setup.py build || report_failure
python setup.py build_sphinx -c docs/docs/python --build-dir docs/sphinx.$$ || report_failure
# sphinx will read in the _dlib_pybind11 module and use that to name everything. But that's
# not what we want, so we rename that to dlib everywhere. You would think sphinx would be
# able to deal with the dlib/__init__.py file and this wouldn't be necessary, but that
# doesn't seem to be the case.
find docs/sphinx.$$ -type f | xargs sed -i -e "s/_dlib_pybind11/dlib/g"
cd docs
cp -r sphinx.$$/html docs/web/python
mv sphinx.$$/html docs/chm/docs/python

Loading…
Cancel
Save