cythonize: use the last part in the modname (example: lxml.etree modulename is etree only.)
This commit is contained in:
parent
3d6297e6fc
commit
199850bec5
1 changed files with 6 additions and 0 deletions
|
@ -22,12 +22,17 @@ def do(fn):
|
|||
fn_c = fn[:-3] + 'c'
|
||||
with open(fn_c) as fd:
|
||||
data = fd.read()
|
||||
modname = modname.split('.')[-1]
|
||||
pat1 = 'init{}(void)'.format(modname)
|
||||
sub1 = 'init{}_{}(void)'.format(package, modname)
|
||||
pat2 = 'PyInit_{}(void)'.format(modname)
|
||||
sub2 = 'PyInit{}_{}(void)'.format(package, modname)
|
||||
pat3 = 'Pyx_NAMESTR("{}")'.format(modname)
|
||||
sub3 = 'Pyx_NAMESTR("{}_{}")'.format(package, modname)
|
||||
|
||||
print '1: {} -> {}'.format(pat1, sub1)
|
||||
print '2: {} -> {}'.format(pat2, sub2)
|
||||
print '3: {} -> {}'.format(pat3, sub3)
|
||||
data = data.replace(pat1, sub1)
|
||||
data = data.replace(pat2, sub2)
|
||||
data = data.replace(pat3, sub3)
|
||||
|
@ -37,5 +42,6 @@ def do(fn):
|
|||
fd.write(data)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print '-- cythonize', sys.argv
|
||||
for fn in sys.argv[1:]:
|
||||
do(fn)
|
||||
|
|
Loading…
Reference in a new issue