Skip to content

Commit

Permalink
[fix] import error c_funcptr_sig_re, c_sig_re (sphinx-doc/sphinx@0f49…
Browse files Browse the repository at this point in the history
…e30c)

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>
  • Loading branch information
return42 committed Apr 26, 2020
1 parent 2c7fd1e commit 48f09de
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions linuxdoc/cdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,36 @@
For user documentation see :ref:`customized-c-domain`.
"""

import re

from docutils import nodes
from docutils.parsers.rst import directives

import sphinx
from sphinx import addnodes
from sphinx.locale import _
from sphinx.domains.c import c_funcptr_sig_re, c_sig_re
from sphinx.domains.c import CObject as Base_CObject
from sphinx.domains.c import CDomain as Base_CDomain

__version__ = '1.0'
# fixes https://github.com/sphinx-doc/sphinx/commit/0f49e30c51b5cc5055cda5b4b294c2dd9d1df573#r38750737

# pylint: disable=invalid-name
c_sig_re = re.compile(
r'''^([^(]*?) # return type
([\w:.]+) \s* # thing name (colon allowed for C++)
(?: \((.*)\) )? # optionally arguments
(\s+const)? $ # const specifier
''', re.VERBOSE)

c_funcptr_sig_re = re.compile(
r'''^([^(]+?) # return type
(\( [^()]+ \)) \s* # name in parentheses
\( (.*) \) # arguments
(\s+const)? $ # const specifier
''', re.VERBOSE)
# pylint: enable=invalid-name

__version__ = '1.0.1'

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

0 comments on commit 48f09de

Please sign in to comment.