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
Gwenaël Samain
cython
Commits
a0ec9c54
Commit
a0ec9c54
authored
Feb 13, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow distutils directives in test files.
parent
bda90138
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+20
-8
runtests.py
runtests.py
+8
-2
No files found.
Cython/Build/Dependencies.py
View file @
a0ec9c54
...
...
@@ -148,14 +148,18 @@ distutils_settings = {
@
cython
.
locals
(
start
=
long
,
end
=
long
)
def
line_iter
(
source
):
start
=
0
while
True
:
end
=
source
.
find
(
'
\
n
'
,
start
)
if
end
==
-
1
:
yield
source
[
start
:]
return
yield
source
[
start
:
end
]
start
=
end
+
1
if
isinstance
(
source
,
file
):
for
line
in
source
:
yield
line
else
:
start
=
0
while
True
:
end
=
source
.
find
(
'
\
n
'
,
start
)
if
end
==
-
1
:
yield
source
[
start
:]
return
yield
source
[
start
:
end
]
start
=
end
+
1
class
DistutilsInfo
(
object
):
...
...
@@ -225,6 +229,14 @@ class DistutilsInfo(object):
resolved
.
values
[
key
]
=
value
return
resolved
def
apply
(
self
,
extension
):
for
key
,
value
in
self
.
values
.
items
():
type
=
distutils_settings
[
key
]
if
type
in
[
list
,
transitive_list
]:
getattr
(
extension
,
key
).
extend
(
value
)
else
:
setattr
(
extension
,
key
,
value
)
@
cython
.
locals
(
start
=
long
,
q
=
long
,
single_q
=
long
,
double_q
=
long
,
hash_mark
=
long
,
end
=
long
,
k
=
long
,
counter
=
long
,
quote_len
=
long
)
def
strip_string_literals
(
code
,
prefix
=
'__Pyx_L'
):
...
...
runtests.py
View file @
a0ec9c54
...
...
@@ -75,6 +75,7 @@ from distutils.command.build_ext import build_ext as _build_ext
from
distutils
import
sysconfig
distutils_distro
=
Distribution
()
if
sys
.
platform
==
'win32'
:
# TODO: Figure out why this hackery (see http://thread.gmane.org/gmane.comp.python.cython.devel/8280/).
config_files
=
distutils_distro
.
find_config_files
()
...
...
@@ -204,7 +205,7 @@ EXCLUDE_EXT = object()
EXT_EXTRAS = {
'tag:numpy' : update_numpy_extension,
'tag:openmp': update_openmp_extension,
'tag:trace'
:
update_linetrace_extension,
'tag:trace'
:
update_linetrace_extension,
}
...
...
@@ -334,7 +335,7 @@ def parse_tags(filepath):
if tag == 'tags':
tag = 'tag'
print("
WARNING
:
test
tags
use
the
'tag'
directive
,
not
'tags'
(
%
s
)
" % filepath)
if tag not in ('mode', 'tag', 'ticket', 'cython'):
if tag not in ('mode', 'tag', 'ticket', 'cython'
, 'distutils'
):
print("
WARNING
:
unknown
test
directive
'%s'
found
(
%
s
)
" % (tag, filepath))
values = values.split(',')
tags[tag].extend(filter(None, [value.strip() for value in values]))
...
...
@@ -772,6 +773,11 @@ class CythonCompileTestCase(unittest.TestCase):
# Set the language now as the fixer might need it
extension.language = 'c++'
if 'distutils' in self.tags:
from Cython.Build.Dependencies import DistutilsInfo
pyx_path = os.path.join(self.test_directory, self.module + "
.
pyx
")
DistutilsInfo(open(pyx_path)).apply(extension)
for matcher, fixer in list(EXT_EXTRAS.items()):
if isinstance(matcher, str):
# lazy init
...
...
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