build commands Linux: use python or python2

master
david.verelst 12 years ago
parent 542a4d16c8
commit 5e173c9fd2

@ -4,6 +4,7 @@ f2py c_library.pyf c_functions.c -c
See also http://www.scipy.org/Cookbook/CompilingExtensionsOnWindowsWithMinGW See also http://www.scipy.org/Cookbook/CompilingExtensionsOnWindowsWithMinGW
""" """
import os import os
import sys
def which(program): def which(program):
""" """
@ -21,7 +22,7 @@ def which(program):
def is_exe(fpath): def is_exe(fpath):
return os.path.exists(fpath) and os.access(fpath, os.X_OK) return os.path.exists(fpath) and os.access(fpath, os.X_OK)
fpath, unused_fname = os.path.split(program) fpath, unused_fname = os.path.split(program)
if fpath: if fpath:
if is_exe(program): if is_exe(program):
@ -31,35 +32,39 @@ def which(program):
exe_file = os.path.join(path, program) exe_file = os.path.join(path, program)
if is_exe(exe_file): if is_exe(exe_file):
return exe_file return exe_file
return None return None
def f2py_call_str(): def f2py_call_str():
# regardless of platform, try to figure out which f2py call is in the path # regardless of platform, try to figure out which f2py call is in the path
# define possible options # define possible options
f2py_call_list = ('f2py','f2py2.6','f2py2.7','f2py.py',)
no_f2py = True
for k in f2py_call_list:
# if the call command exists in the path, it will return the path as
# a string, otherwise it will return None
f2py_path = which(k)
no_f2py = not f2py_path
if no_f2py:
# didn't find the current call k, continue looking
pass
else:
# current call k is in the path
f2py_call = k
break
# raise exception if f2py is not found # on Arch Linux, python and f2py are the calls corresponding to python 3
if no_f2py: # and python2/f2py2 for python 2
raise UserWarning, \ # other Linux versions might still use python/f2py for python 2
'Couldn\'t locate f2py. Should be part of NumPy installation.' if os.path.basename(sys.executable).endswith('2'):
for k in ('f2py2','f2py2.6','f2py2.7',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
# on Windows and other Linux using python/f2py
else: else:
for k in ('f2py','f2py2.6','f2py2.7','f2py.py',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
try:
print 'found f2py in:', f2py_path print 'found f2py in:', f2py_path
return f2py_call return f2py_call
# raise exception if f2py is not found, f2py_path variable will not exist
except NameError:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
# # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ... # # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# # TODO: more robust approach, find out what f2py is in the users path # # TODO: more robust approach, find out what f2py is in the users path
# if os.name == 'posix': # if os.name == 'posix':

@ -5,6 +5,7 @@ gfortran -W -Wall -pedantic-errors -fbounds-check -Werror -c dsvdc.f mregmodule.
""" """
import os import os
import sys
def which(program): def which(program):
""" """
@ -38,29 +39,33 @@ def which(program):
def f2py_call_str(): def f2py_call_str():
# regardless of platform, try to figure out which f2py call is in the path # regardless of platform, try to figure out which f2py call is in the path
# define possible options # define possible options
f2py_call_list = ('f2py','f2py2.6','f2py2.7','f2py.py',)
no_f2py = True # on Arch Linux, python and f2py are the calls corresponding to python 3
for k in f2py_call_list: # and python2/f2py2 for python 2
# if the call command exists in the path, it will return the path as # other Linux versions might still use python/f2py for python 2
# a string, otherwise it will return None if os.path.basename(sys.executable).endswith('2'):
f2py_path = which(k) for k in ('f2py2','f2py2.6','f2py2.7',):
no_f2py = not f2py_path # if we found the f2py path, no need to look further
if no_f2py: if which(k):
# didn't find the current call k, continue looking f2py_call = k
pass f2py_path = which(k)
else: break
# current call k is in the path # on Windows and other Linux using python/f2py
f2py_call = k
break
# raise exception if f2py is not found
if no_f2py:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
else: else:
for k in ('f2py','f2py2.6','f2py2.7','f2py.py',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
try:
print 'found f2py in:', f2py_path print 'found f2py in:', f2py_path
return f2py_call return f2py_call
# raise exception if f2py is not found, f2py_path variable will not exist
except NameError:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
# # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ... # # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# # TODO: more robust approach, find out what f2py is in the users path # # TODO: more robust approach, find out what f2py is in the users path
# if os.name == 'posix': # if os.name == 'posix':

@ -2,6 +2,7 @@
builds mvn.pyd builds mvn.pyd
""" """
import os import os
import sys
def which(program): def which(program):
""" """
@ -36,29 +37,33 @@ def which(program):
def f2py_call_str(): def f2py_call_str():
# regardless of platform, try to figure out which f2py call is in the path # regardless of platform, try to figure out which f2py call is in the path
# define possible options # define possible options
f2py_call_list = ('f2py','f2py2.6','f2py2.7','f2py.py',)
no_f2py = True # on Arch Linux, python and f2py are the calls corresponding to python 3
for k in f2py_call_list: # and python2/f2py2 for python 2
# if the call command exists in the path, it will return the path as # other Linux versions might still use python/f2py for python 2
# a string, otherwise it will return None if os.path.basename(sys.executable).endswith('2'):
f2py_path = which(k) for k in ('f2py2','f2py2.6','f2py2.7',):
no_f2py = not f2py_path # if we found the f2py path, no need to look further
if no_f2py: if which(k):
# didn't find the current call k, continue looking f2py_call = k
pass f2py_path = which(k)
else: break
# current call k is in the path # on Windows and other Linux using python/f2py
f2py_call = k
break
# raise exception if f2py is not found
if no_f2py:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
else: else:
for k in ('f2py','f2py2.6','f2py2.7','f2py.py',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
try:
print 'found f2py in:', f2py_path print 'found f2py in:', f2py_path
return f2py_call return f2py_call
# raise exception if f2py is not found, f2py_path variable will not exist
except NameError:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
# # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ... # # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# # TODO: more robust approach, find out what f2py is in the users path # # TODO: more robust approach, find out what f2py is in the users path
# if os.name == 'posix': # if os.name == 'posix':

@ -2,6 +2,7 @@
builds mvnprdmod.pyd builds mvnprdmod.pyd
""" """
import os import os
import sys
def which(program): def which(program):
""" """
@ -36,29 +37,33 @@ def which(program):
def f2py_call_str(): def f2py_call_str():
# regardless of platform, try to figure out which f2py call is in the path # regardless of platform, try to figure out which f2py call is in the path
# define possible options # define possible options
f2py_call_list = ('f2py','f2py2.6','f2py2.7','f2py.py',)
no_f2py = True # on Arch Linux, python and f2py are the calls corresponding to python 3
for k in f2py_call_list: # and python2/f2py2 for python 2
# if the call command exists in the path, it will return the path as # other Linux versions might still use python/f2py for python 2
# a string, otherwise it will return None if os.path.basename(sys.executable).endswith('2'):
f2py_path = which(k) for k in ('f2py2','f2py2.6','f2py2.7',):
no_f2py = not f2py_path # if we found the f2py path, no need to look further
if no_f2py: if which(k):
# didn't find the current call k, continue looking f2py_call = k
pass f2py_path = which(k)
else: break
# current call k is in the path # on Windows and other Linux using python/f2py
f2py_call = k
break
# raise exception if f2py is not found
if no_f2py:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
else: else:
for k in ('f2py','f2py2.6','f2py2.7','f2py.py',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
try:
print 'found f2py in:', f2py_path print 'found f2py in:', f2py_path
return f2py_call return f2py_call
# raise exception if f2py is not found, f2py_path variable will not exist
except NameError:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
# # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ... # # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# # TODO: more robust approach, find out what f2py is in the users path # # TODO: more robust approach, find out what f2py is in the users path
# if os.name == 'posix': # if os.name == 'posix':

@ -1,11 +1,12 @@
""" """
Builds rindmod.pyd Builds rindmod.pyd
See also See also
http://www.scipy.org/Cookbook/CompilingExtensionsOnWindowsWithMinGW http://www.scipy.org/Cookbook/CompilingExtensionsOnWindowsWithMinGW
""" """
import os import os
import sys
def which(program): def which(program):
""" """
@ -39,29 +40,33 @@ def which(program):
def f2py_call_str(): def f2py_call_str():
# regardless of platform, try to figure out which f2py call is in the path # regardless of platform, try to figure out which f2py call is in the path
# define possible options # define possible options
f2py_call_list = ('f2py','f2py2.6','f2py2.7','f2py.py',)
no_f2py = True
for k in f2py_call_list:
# if the call command exists in the path, it will return the path as
# a string, otherwise it will return None
f2py_path = which(k)
no_f2py = not f2py_path
if no_f2py:
# didn't find the current call k, continue looking
pass
else:
# current call k is in the path
f2py_call = k
break
# raise exception if f2py is not found # on Arch Linux, python and f2py are the calls corresponding to python 3
if no_f2py: # and python2/f2py2 for python 2
raise UserWarning, \ # other Linux versions might still use python/f2py for python 2
'Couldn\'t locate f2py. Should be part of NumPy installation.' if os.path.basename(sys.executable).endswith('2'):
for k in ('f2py2','f2py2.6','f2py2.7',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
# on Windows and other Linux using python/f2py
else: else:
for k in ('f2py','f2py2.6','f2py2.7','f2py.py',):
# if we found the f2py path, no need to look further
if which(k):
f2py_call = k
f2py_path = which(k)
break
try:
print 'found f2py in:', f2py_path print 'found f2py in:', f2py_path
return f2py_call return f2py_call
# raise exception if f2py is not found, f2py_path variable will not exist
except NameError:
raise UserWarning, \
'Couldn\'t locate f2py. Should be part of NumPy installation.'
# # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ... # # this might vary among specific cases: f2py, f2py2.7, f2py3.2, ...
# # TODO: more robust approach, find out what f2py is in the users path # # TODO: more robust approach, find out what f2py is in the users path
# if os.name == 'posix': # if os.name == 'posix':

Loading…
Cancel
Save