build_all.py scripts in source now call to f2py2.6 on posix systems (this might give issues on other installation, for instance when it is f2py, f2yp2.7, etc). On nt (windows) it remains f2py.py.

The general setup.py and build_all.py scripts now copies the .so compiled libraries when on posix platform, on nt (windows) these are the .pyd files
master
david.verelst 14 years ago
parent 49e5e9d6e4
commit d2bd3dee53

@ -10,7 +10,22 @@ def compile_all():
root_dir = os.path.join(wd,'src',pkg_name) root_dir = os.path.join(wd,'src',pkg_name)
root_src = os.path.join(root_dir, 'source') root_src = os.path.join(root_dir, 'source')
buildscript = 'build_all.py' buildscript = 'build_all.py'
build_call = buildfile ='python.exe %s' % buildscript
# if Linux
if os.name == 'posix':
build_call = 'python %s' % buildscript
lib_ext = '.so'
# On Windows
elif os.name == 'nt':
build_call = 'python.exe %s' % buildscript
lib_ext = '.pyd'
# give an Error for other OS-es
else:
raise UserWarning, \
'Untested platform:', os.name
for root, dirs, files in os.walk(root_src): for root, dirs, files in os.walk(root_src):
dir1 = [dir for dir in dirs if not os.path.exists(os.path.join(root,dir,buildscript))] dir1 = [dir for dir in dirs if not os.path.exists(os.path.join(root,dir,buildscript))]
for dir in dir1: for dir in dir1:
@ -23,7 +38,7 @@ def compile_all():
print(t) print(t)
for file in os.listdir('.'): for file in os.listdir('.'):
if file.endswith('.pyd'): if file.endswith(lib_ext):
dest_file = os.path.join(root_dir, file) dest_file = os.path.join(root_dir, file)
if os.path.exists(dest_file): if os.path.exists(dest_file):
os.remove(dest_file) os.remove(dest_file)

@ -118,9 +118,24 @@ if __name__=='__main__':
if not (f.startswith('.') or f.endswith('~') or if not (f.startswith('.') or f.endswith('~') or
f.endswith('.old') or f.endswith('.bak') or f.endswith('.old') or f.endswith('.bak') or
f.endswith('.py') or f.endswith('test') )] f.endswith('.py') or f.endswith('test') )]
libs = [f for f in os.listdir(os.path.join(root_dir)) if f.endswith('.pyd') ]
packagedata = testscripts + datafiles + libs #['c_library.pyd'] #,'disufq1.c','diffsumfunq.pyd','diffsumfunq.pyf','findrfc.c','rfc.pyd','rfc.pyf']
# executable library on Linux has extension .so
if os.name == 'posix':
lib_ext = '.so'
# extension on Windows is .pyd
elif os.name == 'nt':
lib_ext = '.pyd'
# give an Error for other OS-es
else:
raise UserWarning, \
'Platform not supported:', os.name
libs = [f for f in os.listdir(os.path.join(root_dir)) if f.endswith(lib_ext) ]
# libs = [f for f in os.listdir(os.path.join(root_dir)) if f.endswith('.pyd') ]
packagedata = testscripts + datafiles + libs #['c_library.pyd'] #,'disufq1.c','diffsumfunq.pyd','diffsumfunq.pyf','findrfc.c','rfc.pyd','rfc.pyf']
setup( setup(
version = VERSION, version = VERSION,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -6,16 +6,29 @@ See also http://www.scipy.org/Cookbook/CompilingExtensionsOnWindowsWithMinGW
import os import os
def compile_all(): def compile_all():
# Install gfortran and run the following to build the module:
#compile_format = 'f2py.py %s %s -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71' # on Linux my linux version it is f2py2.6, don't know how that is on others
if os.name == 'posix':
# this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# TODO: more robust approach, find out what f2py is in the users path
compile_format = 'f2py2.6 %s %s -c'
# Install microsoft visual c++ .NET 2003 and run the following to build the module: # Install microsoft visual c++ .NET 2003 and run the following to build the module:
elif os.name == 'nt':
# compile_format = 'f2py.py %s %s -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71'
compile_format = 'f2py.py %s %s -c' compile_format = 'f2py.py %s %s -c'
# give an Error for other OS-es
else:
raise UserWarning, \
'Untested platform:', os.name
pyfs = ('c_library.pyf',) pyfs = ('c_library.pyf',)
files =('c_functions.c',) files =('c_functions.c',)
for pyf,file in zip(pyfs,files): for pyf,file in zip(pyfs,files):
os.system(compile_format % (pyf,file)) os.system(compile_format % (pyf,file))
# f2py.py c_library.pyf c_functions.c -c
if __name__=='__main__': if __name__=='__main__':
compile_all() compile_all()

@ -4,8 +4,25 @@ builds mvn.pyd
import os import os
def compile_all(): def compile_all():
#os.system('f2py.py mvn.pyf mvndst.f -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71 ') #os.system('f2py.py mvn.pyf mvndst.f -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71 ')
os.system('f2py.py mvn.pyf mvndst.f -c ')
# this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# TODO: more robust approach, find out what f2py is in the users path
if os.name == 'posix':
f2py_call = 'f2py2.6'
# Install microsoft visual c++ .NET 2003 and run the following to build the module:
elif os.name == 'nt':
f2py_call = 'f2py.py'
# give an Error for other OS-es
else:
raise UserWarning, \
'Untested platform:', os.name
os.system(f2py_call + ' mvn.pyf mvndst.f -c ')
if __name__=='__main__': if __name__=='__main__':
compile_all() compile_all()

@ -10,8 +10,22 @@ def compile_all():
os.system(compile1_format % file) os.system(compile1_format % file)
file_objects = '%s.o %s.o' % tuple(files) file_objects = '%s.o %s.o' % tuple(files)
# this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# TODO: more robust approach, find out what f2py is in the users path
if os.name == 'posix':
f2py_call = 'f2py2.6'
# Install microsoft visual c++ .NET 2003 and run the following to build the module:
elif os.name == 'nt':
f2py_call = 'f2py.py'
# give an Error for other OS-es
else:
raise UserWarning, \
'Untested platform:', os.name
#os.system('f2py.py -m mvnprdmod -c %s mvnprd_interface.f --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71' % file_objects) #os.system('f2py.py -m mvnprdmod -c %s mvnprd_interface.f --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71' % file_objects)
os.system('f2py.py -m mvnprdmod -c %s mvnprd_interface.f ' % file_objects) os.system(f2py_call + ' -m mvnprdmod -c %s mvnprd_interface.f ' % file_objects)
if __name__=='__main__': if __name__=='__main__':
compile_all() compile_all()

@ -11,7 +11,21 @@ def compile_all():
os.system(compile1_format % file) os.system(compile1_format % file)
file_objects = format1 % tuple(files) file_objects = format1 % tuple(files)
os.system('f2py.py -m rindmod -c %s rind_interface.f ' % file_objects) # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# TODO: more robust approach, find out what f2py is in the users path
if os.name == 'posix':
f2py_call = 'f2py2.6'
# Install microsoft visual c++ .NET 2003 and run the following to build the module:
elif os.name == 'nt':
f2py_call = 'f2py.py'
# give an Error for other OS-es
else:
raise UserWarning, \
'Untested platform:', os.name
os.system(f2py_call + ' -m rindmod -c %s rind_interface.f ' % file_objects)
if __name__=='__main__': if __name__=='__main__':
compile_all() compile_all()

Loading…
Cancel
Save