diff --git a/.gitignore b/.gitignore index d7c2618ab..118d33efc 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/docs/docs/python/generate_dlib_listing.py b/docs/docs/python/generate_dlib_listing.py index 2aaff2458..5a42c08a1 100644 --- a/docs/docs/python/generate_dlib_listing.py +++ b/docs/docs/python/generate_dlib_listing.py @@ -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) diff --git a/docs/docs/python/index.rst b/docs/docs/python/index.rst index 6ad2d3d5b..3b17a1814 100644 --- a/docs/docs/python/index.rst +++ b/docs/docs/python/index.rst @@ -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: diff --git a/docs/makedocs b/docs/makedocs index e4a384ee7..872edf47c 100755 --- a/docs/makedocs +++ b/docs/makedocs @@ -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