0 0 1
2.7-vms
Jean-Francois Pieronne - 5 years ago 2014-10-29 12:23:19
jf.pieronne@laposte.net
Add vms/build_cython_module.py
1 file changed with 40 insertions and 0 deletions:
↑ Collapse Diff ↑
 
new file 100644
1
 
import sys
2
 
import os
3
 
import tempfile
4
 
import vms.crtl
5
 
import vms.rtl.lib
6
 

	
7
 
template = """$ @python_vms:python_compiler_options
8
 
$ PYTHON_C_DEBUG = f$trnlnm("PYTHON_C_DEBUG")
9
 
$ PYTHON_C_FLOAT = f$trnlnm("PYTHON_C_FLOAT")
10
 
$ PYTHON_C_NAMES = f$trnlnm("PYTHON_C_NAMES")
11
 
$ PYTHON_C_OPTIM = f$trnlnm("PYTHON_C_OPTIM")
12
 
$ cython %s.pyx -2 %s
13
 
$ cc 'PYTHON_C_DEBUG' 'PYTHON_C_FLOAT' 'PYTHON_C_NAMES' 'PYTHON_C_OPTIM' -
14
 
	/include=(python_include)/define=(_USE_STD_STAT=1,__USE_INO64=1,-
15
 
_LARGEFILE,__NEW_STARLET,_POSIX_EXIT=1) %s.c
16
 
$ link/share=%s.exe sys$input:/opt
17
 
GSMATCH=lequal,1,1000
18
 
case_sensitive=YES
19
 
SYMBOL_VECTOR = (init%s=PROCEDURE)
20
 
SYMBOL_VECTOR = (INIT%s/init%s=PROCEDURE)
21
 
case_sensitive=NO
22
 
%s.obj
23
 
pythonshr/share
24
 
$
25
 
$ delete %s;*
26
 
"""
27
 

	
28
 
p1 = sys.argv[1]
29
 
up1 = p1.upper()
30
 
incl = ""
31
 
for i in range(len(sys.argv) - 2):
32
 
    incl += '-I "%s" ' % sys.argv[i + 2]
33
 

	
34
 
fd, fn = tempfile.mkstemp(suffix=".com")
35
 
cmd = template % (p1, incl, p1, p1, p1, up1, p1, p1, vms.crtl.to_vms(fn))
36
 

	
37
 
os.write(fd, cmd)
38
 
os.close(fd)
39
 
cmd = '@%s' % (vms.crtl.to_vms(fn),)
40
 
vms.rtl.lib.do_command(cmd)
0 comments (0 inline, 0 general)