Commit 158b463e authored by Jason R. Coombs's avatar Jason R. Coombs

Merged in lsinger/setuptools (pull request #39)

Map .pyx sources to .c or .cpp depending on language
parents 7a47250f a0c7e67a
...@@ -27,7 +27,18 @@ class Extension(_Extension): ...@@ -27,7 +27,18 @@ class Extension(_Extension):
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
_Extension.__init__(self, *args, **kw) _Extension.__init__(self, *args, **kw)
if not have_pyrex(): if not have_pyrex():
self._convert_pyx_sources_to_c() if self.language.lower() == 'c++':
self._convert_pyx_sources_to_cpp()
else:
self._convert_pyx_sources_to_c()
def _convert_pyx_sources_to_cpp(self):
"convert .pyx extensions to .cpp"
def pyx_to_c(source):
if source.endswith('.pyx'):
source = source[:-4] + '.cpp'
return source
self.sources = list(map(pyx_to_c, self.sources))
def _convert_pyx_sources_to_c(self): def _convert_pyx_sources_to_c(self):
"convert .pyx extensions to .c" "convert .pyx extensions to .c"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment