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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
dc554166
Commit
dc554166
authored
Sep 10, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repair build in Py3.2
parent
f0418979
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
setup.py
setup.py
+13
-11
No files found.
setup.py
View file @
dc554166
...
...
@@ -167,23 +167,26 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan
# XXX hack around setuptools quirk for '*.pyx' sources
extensions
[
-
1
].
sources
[
0
]
=
pyx_source_file
from
Cython.Distutils
import
build_ext
if
sys
.
version_info
[:
2
]
==
(
3
,
2
):
# Python 3.2: can only run Cython *after* running 2to3
build_ext
=
_defer_cython_import_in_py32
(
build_ext
,
source_root
,
profile
)
elif
profile
:
from
Cython.Compiler.Options
import
directive_defaults
directive_defaults
[
'profile'
]
=
True
sys
.
stderr
.
write
(
"Enabled profiling for the Cython binary modules
\
n
"
)
build_ext
=
_defer_cython_import_in_py32
(
source_root
,
profile
)
else
:
from
Cython.Distutils
import
build_ext
if
profile
:
from
Cython.Compiler.Options
import
directive_defaults
directive_defaults
[
'profile'
]
=
True
sys
.
stderr
.
write
(
"Enabled profiling for the Cython binary modules
\
n
"
)
# not using cythonize() here to let distutils decide whether building extensions was requested
add_command_class
(
"build_ext"
,
build_ext
)
setup_args
[
'ext_modules'
]
=
extensions
def
_defer_cython_import_in_py32
(
build_ext_orig
,
source_root
,
profile
=
False
):
def
_defer_cython_import_in_py32
(
source_root
,
profile
=
False
):
# Python 3.2: can only run Cython *after* running 2to3
# => re-import Cython inside of build_ext
from
distutils.command.build_ext
import
build_ext
as
build_ext_orig
class
build_ext
(
build_ext_orig
):
# we must keep the original modules alive to make sure
# their code keeps working when we remove them from
...
...
@@ -205,16 +208,15 @@ def _defer_cython_import_in_py32(build_ext_orig, source_root, profile=False):
del
sys
.
modules
[
module
]
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
source_root
,
self
.
build_lib
))
def
finalize_options
(
self
):
self
.
__reimport
()
super
(
build_ext
,
self
).
finalize_options
()
def
build_extensions
(
self
):
self
.
__reimport
()
if
profile
:
from
Cython.Compiler.Options
import
directive_defaults
directive_defaults
[
'profile'
]
=
True
print
(
"Enabled profiling for the Cython binary modules"
)
from
Cython.Build.Dependencies
import
cythonize
self
.
distribution
.
ext_modules
[:]
=
cythonize
(
self
.
distribution
.
ext_modules
)
build_ext_orig
.
build_extensions
(
self
)
return
build_ext
...
...
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