Skip to content

Commit 48f09de

Browse files
committed
[fix] import error c_funcptr_sig_re, c_sig_re (sphinx-doc/sphinx@0f49e30c)
Extension error: Could not import extension linuxdoc.cdomain .. \ (exception: cannot import name 'c_funcptr_sig_re' from .. Issue: `sphinx-doc/sphinx#7421`_ .. _0f49e30c: sphinx-doc/sphinx@0f49e30#r38750737 .. _sphinx-doc/sphinx#7421: sphinx-doc/sphinx#7421 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
1 parent 2c7fd1e commit 48f09de

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

linuxdoc/cdomain.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,36 @@
1111
For user documentation see :ref:`customized-c-domain`.
1212
"""
1313

14+
import re
15+
1416
from docutils import nodes
1517
from docutils.parsers.rst import directives
1618

1719
import sphinx
1820
from sphinx import addnodes
1921
from sphinx.locale import _
20-
from sphinx.domains.c import c_funcptr_sig_re, c_sig_re
2122
from sphinx.domains.c import CObject as Base_CObject
2223
from sphinx.domains.c import CDomain as Base_CDomain
2324

24-
__version__ = '1.0'
25+
# fixes https://github.com/sphinx-doc/sphinx/commit/0f49e30c51b5cc5055cda5b4b294c2dd9d1df573#r38750737
26+
27+
# pylint: disable=invalid-name
28+
c_sig_re = re.compile(
29+
r'''^([^(]*?) # return type
30+
([\w:.]+) \s* # thing name (colon allowed for C++)
31+
(?: \((.*)\) )? # optionally arguments
32+
(\s+const)? $ # const specifier
33+
''', re.VERBOSE)
34+
35+
c_funcptr_sig_re = re.compile(
36+
r'''^([^(]+?) # return type
37+
(\( [^()]+ \)) \s* # name in parentheses
38+
\( (.*) \) # arguments
39+
(\s+const)? $ # const specifier
40+
''', re.VERBOSE)
41+
# pylint: enable=invalid-name
42+
43+
__version__ = '1.0.1'
2544

2645
# Get Sphinx version
2746
major, minor, patch = sphinx.version_info[:3] # pylint: disable=invalid-name

0 commit comments

Comments
 (0)