Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools_dso
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
setuptools_dso
Commits
b49e171c
Commit
b49e171c
authored
Nov 17, 2019
by
Michael Davidsaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cythonize wrapper
parent
e40f5883
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
src/setuptools_dso/__init__.py
src/setuptools_dso/__init__.py
+21
-0
No files found.
src/setuptools_dso/__init__.py
View file @
b49e171c
...
...
@@ -14,6 +14,9 @@ __all__ = (
)
def
setup
(
**
kws
):
"""Wrapper around setuptools.setup() which injects extra Commands
needed to build DSOs.
"""
cmdclass
=
kws
.
setdefault
(
'cmdclass'
,
{})
# cmdclass_setdefault sets default to cmdclass[name]=klass and verifies
# that cmdclass[name] is a subclass of klass. This way we check, for
...
...
@@ -29,3 +32,21 @@ def setup(**kws):
cmdclass_setdefault
(
'build_ext'
,
build_ext
)
kws
.
setdefault
(
'zip_safe'
,
len
(
kws
.
get
(
'ext_modules'
,
[]))
==
0
and
len
(
kws
.
get
(
'x_dsos'
,
[]))
==
0
)
_setup
(
**
kws
)
def
cythonize
(
orig
,
**
kws
):
"""Wrapper around Cython.Build.cythonize() to correct handling of
DSO()s and Extension()s using them.
"""
from
Cython.Build
import
cythonize
as
_cythonize
# fails if cython is not actually installed
cmods
=
_cythonize
(
orig
,
**
kws
)
for
new
,
old
in
zip
(
cmods
,
orig
):
if
new
is
old
or
not
isinstance
(
old
,
Extension
):
continue
assert
isinstance
(
new
,
Extension
),
new
# _cythonize() has re-created our Extension.
# The correct class is used, but our special attributes are lost.
# So we copy them over
for
key
in
(
'dsos'
,
'lang_compile_args'
,
'soversion'
):
if
hasattr
(
old
,
key
):
setattr
(
new
,
key
,
getattr
(
old
,
key
))
return
cmods
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