blob: 55a4d94684a8f21ee680e6541a6c228668c2cbd3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from distutils.core import Extension as _Extension
try:
from Pyrex.Distutils.build_ext import build_ext
except ImportError:
# Pyrex isn't around, so fix up the sources
class Extension(_Extension):
"""Extension that uses '.c' files in place of '.pyx' files"""
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
else:
# Pyrex is here, just use regular extension type
Extension = _Extension
|