Commit 9f5991b3 authored by Jason R. Coombs's avatar Jason R. Coombs

Refactored Extension class so that __init__ is always called, but patched...

Refactored Extension class so that __init__ is always called, but patched behavior is still selected by has_pyrex.

--HG--
branch : distribute
extra : rebase_source : d5670bf4bc6606d828b4ec7be055e26a7d4a9730
parent 5e47a200
......@@ -21,17 +21,15 @@ have_pyrex = 'build_ext' in globals()
class Extension(_Extension):
"""Extension that uses '.c' files in place of '.pyx' files"""
if not have_pyrex:
# convert .pyx extensions to .c
def __init__(self, *args, **kw):
_Extension.__init__(self, *args, **kw)
sources = []
for s in self.sources:
if s.endswith('.pyx'):
sources.append(s[:-3] + 'c')
else:
sources.append(s)
self.sources = sources
def __init__(self, *args, **kw):
_Extension.__init__(self, *args, **kw)
if not have_pyrex:
self._convert_pyx_sources_to_c()
def _convert_pyx_sources_to_c(self):
"convert .pyx extensions to .c"
self.sources = [source[:-3] + 'c' for source in self.sources
if source.endswith('.pyx')]
class Library(Extension):
"""Just like a regular Extension, but built as a library instead"""
......
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