Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
fc551f60
Commit
fc551f60
authored
9 years ago
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly parse dependencies of "cimport foo,bar"
parent
e13fa642
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+6
-6
tests/compile/distutils_libraries_T845.srctree
tests/compile/distutils_libraries_T845.srctree
+2
-2
No files found.
Cython/Build/Dependencies.py
View file @
fc551f60
...
...
@@ -342,8 +342,8 @@ def strip_string_literals(code, prefix='__Pyx_L'):
return
""
.
join
(
new_code
),
literals
depend
a
ncy_regex
=
re
.
compile
(
r"(?:^from +([0-9a-zA-Z_.]+) +cimport)|"
r"(?:^cimport +([0-9a-zA-Z_.]+
)\b
)|"
depend
e
ncy_regex
=
re
.
compile
(
r"(?:^from +([0-9a-zA-Z_.]+) +cimport)|"
r"(?:^cimport +([0-9a-zA-Z_.]+
(?: *, *[0-9a-zA-Z_.]+)*)
)|"
r"(?:^cdef +extern +from +['\"]([^'\"]+)['\"])|"
r"(?:^include +['\"]([^'\"]+)['\"])"
,
re
.
M
)
...
...
@@ -412,12 +412,12 @@ def parse_dependencies(source_filename):
cimports
=
[]
includes
=
[]
externs
=
[]
for
m
in
depend
a
ncy_regex
.
finditer
(
source
):
cimport_from
,
cimport
,
extern
,
include
=
m
.
groups
()
for
m
in
depend
e
ncy_regex
.
finditer
(
source
):
cimport_from
,
cimport
_list
,
extern
,
include
=
m
.
groups
()
if
cimport_from
:
cimports
.
append
(
cimport_from
)
elif
cimport
:
cimports
.
append
(
cimport
)
elif
cimport
_list
:
cimports
.
extend
(
x
.
strip
()
for
x
in
cimport_list
.
split
(
","
)
)
elif
extern
:
externs
.
append
(
literals
[
extern
])
else
:
...
...
This diff is collapsed.
Click to expand it.
tests/compile/distutils_libraries_T845.srctree
View file @
fc551f60
...
...
@@ -13,6 +13,7 @@ ext_modules = [
ext_modules = cythonize(ext_modules)
assert len(ext_modules[0].libraries) == 2
assert ext_modules[1].libraries == ["lib_x"]
assert ext_modules[2].libraries == ["lib_y"]
...
...
@@ -23,8 +24,7 @@ assert ext_modules[2].libraries == ["lib_y"]
# distutils: libraries = lib_y
######## a.pyx ########
cimport libx
cimport liby
cimport libx , liby
######## x.pyx ########
cimport libx
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment