11# Pyctools - a picture processing algorithm development kit.
22# http://github.com/jim-easterbrook/pyctools
3- # Copyright (C) 2014-24 Pyctools contributors
3+ # Copyright (C) 2014-25 Pyctools contributors
44#
55# This file is part of Pyctools.
66#
1717# You should have received a copy of the GNU General Public License
1818# along with Pyctools. If not, see <http://www.gnu.org/licenses/>.
1919
20- from collections import defaultdict
2120import os
22- import pkgutil
2321import site
2422import sys
25- import types
26- from unittest .mock import Mock
2723
2824# If extensions (or modules to document with autodoc) are in another directory,
2925# add these directories to sys.path here. If the directory is relative to the
3026# documentation root, use os.path.abspath to make it absolute, like shown here.
3127#sys.path.insert(0, os.path.abspath('.'))
3228site .addsitedir (os .path .abspath ('..' ))
33- on_rtd = os .environ .get ('READTHEDOCS' , None ) == 'True'
34-
35- # cludge to allow documentation to be compiled without installing some
36- # dependencies
37- for mod_name in ('cv2' , 'OpenGL' , 'matplotlib' , 'matplotlib.pyplot' ,
38- 'scipy' , 'scipy.optimize' , 'scipy.signal' , 'scipy.special' ,
39- 'sip' ):
40- sys .modules [mod_name ] = Mock ()
41-
42- # Qt stuff needs a bit more work as it's used as base classes
43- class QtMock (Mock ):
44- QT_VERSION_STR = '0.0.0'
45- QObject = object
46- QWidget = object
47- QGraphicsRectItem = object
48- QGraphicsPolygonItem = object
49- QGLWidget = object
50- QOpenGLWidget = object
51-
52- for mod_name in ('PyQt5' , 'PyQt5.QtCore' , 'PyQt5.QtGui' ,
53- 'PyQt5.QtOpenGL' , 'PyQt5.QtWidgets' ):
54- sys .modules [mod_name ] = QtMock ()
5529
5630# -- General configuration -----------------------------------------------------
5731
5832# If your documentation needs a minimal Sphinx version, state it here.
5933#needs_sphinx = '1.0'
60- needs_sphinx = '2.0'
6134
6235# Add any Sphinx extension module names here, as strings. They can be extensions
6336# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -75,9 +48,9 @@ class QtMock(Mock):
7548
7649intersphinx_mapping = {
7750 'python' : ('https://docs.python.org/3' , None ),
78- 'numpy' : ('http ://docs.scipy.org/doc/numpy/' , None ),
79- 'PIL' : ('http ://pillow.readthedocs.io/en/latest/' , None ),
80- 'scipy' : ('http ://docs.scipy.org/doc/scipy/reference/' , None ),
51+ 'numpy' : ('https ://docs.scipy.org/doc/numpy/' , None ),
52+ 'PIL' : ('https ://pillow.readthedocs.io/en/latest/' , None ),
53+ 'scipy' : ('https ://docs.scipy.org/doc/scipy/reference/' , None ),
8154 }
8255
8356keep_warnings = True
@@ -102,7 +75,7 @@ class QtMock(Mock):
10275
10376# General information about the project.
10477project = u'Pyctools'
105- copyright = u'2014-20 , Pyctools contributors'
78+ copyright = u'2014-25 , Pyctools contributors'
10679
10780# The version info for the project you're documenting, acts as replacement for
10881# |version| and |release|, also used in various other places throughout the
@@ -127,9 +100,9 @@ class QtMock(Mock):
127100# pkgutil.walk_packages doesn't work with namespace packages, so we do
128101# a simple file search instead
129102for path in pyctools .__path__ :
130- depth = len (path .split ('/' )) - 1
103+ depth = len (path .split (os . path . sep )) - 1
131104 for root , dirs , files in os .walk (path ):
132- parts = root .split ('/' )
105+ parts = root .split (os . path . sep )
133106 if parts [- 1 ] == '__pycache__' :
134107 continue
135108 parts = parts [depth :]
@@ -190,7 +163,8 @@ def submodules(parent):
190163 # import module
191164 try :
192165 mod = __import__ (module ['name' ], globals (), locals (), ['*' ])
193- except ImportError :
166+ except ImportError as ex :
167+ print (str (ex ))
194168 continue
195169 module ['mod' ] = mod
196170 if getattr (mod , '__doc__' ):
0 commit comments