mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 18:07:12 +01:00
cython: Enhance import regexp.
* avoid matching commented imports * support `from foo.bar import baz` syntax.
This commit is contained in:
parent
a2105efc6f
commit
af74bbcbee
@ -8,8 +8,9 @@ from waflib.TaskGen import extension
|
|||||||
|
|
||||||
cy_api_pat = re.compile(r'\s*?cdef\s*?(public|api)\w*')
|
cy_api_pat = re.compile(r'\s*?cdef\s*?(public|api)\w*')
|
||||||
re_cyt = re.compile(r"""
|
re_cyt = re.compile(r"""
|
||||||
(?:from\s+(\w+)\s+)? # optionally match "from foo" and capture foo
|
^\s* # must begin with some whitespace characters
|
||||||
c?import\s(\w+|[*]) # require "import bar" and capture bar
|
(?:from\s+(\w+)(?:\.\w+)*\s+)? # optionally match "from foo(.baz)" and capture foo
|
||||||
|
c?import\s(\w+|[*]) # require "import bar" and capture bar
|
||||||
""", re.M | re.VERBOSE)
|
""", re.M | re.VERBOSE)
|
||||||
|
|
||||||
@extension('.pyx')
|
@extension('.pyx')
|
||||||
|
Loading…
Reference in New Issue
Block a user