always use the convention that commands are lists, remove find_perl_program, add interpreter

This commit is contained in:
Jérôme Carretero 2013-09-04 00:44:56 -04:00
parent 1fad148b2c
commit 5064fd92ef
36 changed files with 29 additions and 88 deletions

View File

@ -110,7 +110,7 @@ def configure(conf):
conf.find_program('gnuplot', var='GNUPLOT')
def build(bld):
wafdir_lst = bld.srcnode.ant_glob('.waf-1.6*', dir=True)
wafdir_lst = bld.srcnode.ant_glob('.waf*', dir=True)
if not wafdir_lst:
bld.fatal('Missing local Waf directory')
node = wafdir_lst[0]

View File

@ -487,6 +487,8 @@ def find_program(self, filename, **kw):
:type ext: list of string
:param msg: name to display in the log, by default filename is used
:type msg: string
:param interpreter: interpreter for the program
:type interpreter: ConfigSet variable key
"""
exts = kw.get('exts', Utils.is_win32 and '.exe,.com,.bat,.cmd' or ',.sh,.pl,.py')
@ -540,36 +542,17 @@ def find_program(self, filename, **kw):
if not ret:
self.fatal(kw.get('errmsg', '') or 'Could not find the program %s' % ','.join(filename))
if var:
self.env[var] = ret
ret = self.cmd_to_list(ret)
interpreter = kw.get('interpreter', None)
if interpreter is None:
if not Utils.check_exe(ret[0]):
self.fatal('Program %s is not executable' % ret)
if var:
self.env[var] = ret
else:
if var:
self.env[var] = self.env[interpreter] + ret
return ret
@conf
def find_perl_program(self, filename, path_list=[], var=None, environ=None, exts=''):
"""
Search for a perl program on the operating system
:param filename: file to search for
:type filename: string
:param path_list: list of paths to look into
:type path_list: list of string
:param var: store the results into *conf.env.var*
:type var: string
:param environ: operating system environment to pass to :py:func:`waflib.Configure.find_program`
:type environ: dict
:param exts: extensions given to :py:func:`waflib.Configure.find_program`
:type exts: list
"""
try:
app = self.find_program(filename, path_list=path_list, var=var, environ=environ, exts=exts)
except Exception:
self.find_program('perl', var='PERL')
app = self.find_file(filename, os.environ['PATH'].split(os.pathsep))
if not app:
raise
if var:
self.env[var] = Utils.to_list(self.env['PERL']) + [app]
self.msg('Checking for %r' % filename, app)

View File

@ -15,9 +15,9 @@ def find_dmd(conf):
conf.find_program(['dmd', 'dmd2', 'ldc'], var='D')
# make sure that we're dealing with dmd1, dmd2, or ldc(1)
out = conf.cmd_and_log([conf.env.D, '--help'])
out = conf.cmd_and_log(conf.env.D + ['--help'])
if out.find("D Compiler v") == -1:
out = conf.cmd_and_log([conf.env.D, '-version'])
out = conf.cmd_and_log(conf.env.D + ['-version'])
if out.find("based on DMD v1.") == -1:
conf.fatal("detected compiler is not dmd/ldc")
@ -74,7 +74,7 @@ def configure(conf):
conf.find_dmd()
if sys.platform == 'win32':
out = conf.cmd_and_log([conf.env.D, '--help'])
out = conf.cmd_and_log(conf.env.D + ['--help'])
if out.find("D Compiler v2.") > -1:
conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead')

View File

@ -11,7 +11,6 @@ from waflib.Configure import conf
@conf
def find_g95(conf):
fc = conf.find_program('g95', var='FC')
fc = conf.cmd_to_list(fc)
conf.get_g95_version(fc)
conf.env.FC_NAME = 'G95'

View File

@ -19,10 +19,8 @@ def find_gcc(conf):
Find the program gcc, and if present, try to detect its version number
"""
cc = conf.find_program(['gcc', 'cc'], var='CC')
cc = conf.cmd_to_list(cc)
conf.get_cc_version(cc, gcc=True)
conf.env.CC_NAME = 'gcc'
conf.env.CC = cc
@conf
def gcc_common_flags(conf):

View File

@ -13,7 +13,7 @@ def find_gdc(conf):
"""
conf.find_program('gdc', var='D')
out = conf.cmd_and_log([conf.env.D, '--version'])
out = conf.cmd_and_log(conf.env.D + ['--version'])
if out.find("gdc ") == -1:
conf.fatal("detected compiler is not gdc")

View File

@ -13,7 +13,6 @@ def find_gfortran(conf):
"""Find the gfortran program (will look in the environment variable 'FC')"""
fc = conf.find_program(['gfortran','g77'], var='FC')
# (fallback to g77 for systems, where no gfortran is available)
fc = conf.cmd_to_list(fc)
conf.get_gfortran_version(fc)
conf.env.FC_NAME = 'GFORTRAN'

View File

@ -350,7 +350,8 @@ def configure(conf):
And set the variable *GSETTINGSSCHEMADIR*
"""
conf.find_program('glib-genmarshal', var='GLIB_GENMARSHAL')
conf.find_perl_program('glib-mkenums', var='GLIB_MKENUMS')
conf.find_program('perl', var='PERL')
conf.find_program('glib-mkenums', interpreter='PERL', var='GLIB_MKENUMS')
# when cross-compiling, gsettings.m4 locates the program with the following:
# pkg-config --variable glib_compile_schemas gio-2.0

View File

@ -19,7 +19,6 @@ def find_gxx(conf):
Find the program g++, and if present, try to detect its version number
"""
cxx = conf.find_program(['g++', 'c++'], var='CXX')
cxx = conf.cmd_to_list(cxx)
conf.get_cc_version(cxx, gcc=True)
conf.env.CXX_NAME = 'gcc'
conf.env.CXX = cxx

View File

@ -26,7 +26,6 @@ def find_icc(conf):
if not cc: cc = conf.find_program('icc', var='CC')
if not cc: cc = conf.find_program('ICL', var='CC')
if not cc: conf.fatal('Intel C Compiler (icc) was not found')
cc = conf.cmd_to_list(cc)
conf.get_cc_version(cc, icc=True)
v['CC'] = cc

View File

@ -24,7 +24,6 @@ def find_icpc(conf):
elif 'CXX' in conf.environ: cxx = conf.environ['CXX']
if not cxx: cxx = conf.find_program('icpc', var='CXX')
if not cxx: conf.fatal('Intel C++ Compiler (icpc) was not found')
cxx = conf.cmd_to_list(cxx)
conf.get_cc_version(cxx, icc=True)
v['CXX'] = cxx

View File

@ -11,7 +11,6 @@ from waflib.Configure import conf
@conf
def find_ifort(conf):
fc = conf.find_program('ifort', var='FC')
fc = conf.cmd_to_list(fc)
conf.get_ifort_version(fc)
conf.env.FC_NAME = 'IFORT'

View File

@ -161,7 +161,8 @@ def configure(conf):
If a C/C++ compiler is present, execute a compilation test to find the header *locale.h*.
"""
conf.find_program('msgfmt', var='MSGFMT')
conf.find_perl_program('intltool-merge', var='INTLTOOL')
conf.find_program('perl', var='PERL')
conf.find_program('intltool-merge', interpreter='PERL', var='INTLTOOL')
prefix = conf.env.PREFIX
datadir = conf.env.DATADIR

View File

@ -19,7 +19,6 @@ def find_irixcc(conf):
elif 'CC' in conf.environ: cc = conf.environ['CC']
if not cc: cc = conf.find_program('cc', var='CC')
if not cc: conf.fatal('irixcc was not found')
cc = conf.cmd_to_list(cc)
try:
conf.cmd_and_log(cc + ['-version'])

View File

@ -368,7 +368,6 @@ def configure(self):
for x in 'javac java jar javadoc'.split():
self.find_program(x, var=x.upper(), path_list=java_path)
self.env[x.upper()] = self.cmd_to_list(self.env[x.upper()])
if 'CLASSPATH' in self.environ:
v['CLASSPATH'] = self.environ['CLASSPATH']

View File

@ -14,7 +14,7 @@ def find_ldc2(conf):
conf.find_program(['ldc2'], var='D')
out = conf.cmd_and_log([conf.env.D, '-version'])
out = conf.cmd_and_log(conf.env.D + ['-version'])
if out.find("based on DMD v2.") == -1:
conf.fatal("detected compiler is not ldc2")

View File

@ -161,7 +161,6 @@ echo LIB=%%LIB%%;%%LIBPATH%%
env.update(PATH = path)
compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
cxx = conf.find_program(compiler_name, path_list=MSVC_PATH)
cxx = conf.cmd_to_list(cxx)
# delete CL if exists. because it could contain parameters wich can change cl's behaviour rather catastrophically.
if 'CL' in env:
@ -727,7 +726,6 @@ def find_msvc(conf):
if v['CXX']: cxx = v['CXX']
elif 'CXX' in conf.environ: cxx = conf.environ['CXX']
cxx = conf.find_program(compiler_name, var='CXX', path_list=path)
cxx = conf.cmd_to_list(cxx)
# before setting anything, check if the compiler is really msvc
env = dict(conf.environ)

View File

@ -315,7 +315,7 @@ def check_python_headers(conf):
includes = []
if conf.env.PYTHON_CONFIG:
for incstr in conf.cmd_and_log([ conf.env.PYTHON_CONFIG, '--includes']).strip().split():
for incstr in conf.cmd_and_log(conf.env.PYTHON_CONFIG + ['--includes']).strip().split():
# strip the -I or /I
if (incstr.startswith('-I') or incstr.startswith('/I')):
incstr = incstr[2:]
@ -522,7 +522,6 @@ def configure(conf):
v['PYTHONARCHDIR'] = Options.options.pythonarchdir
conf.find_program('python', var='PYTHON')
conf.env.PYTHON = conf.cmd_to_list(conf.env.PYTHON)
v['PYCMD'] = '"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"'
v['PYFLAGS'] = ''

View File

@ -19,7 +19,6 @@ def find_scc(conf):
elif 'CC' in conf.environ: cc = conf.environ['CC']
if not cc: cc = conf.find_program('cc', var='CC')
if not cc: conf.fatal('Could not find a Sun C compiler')
cc = conf.cmd_to_list(cc)
try:
conf.cmd_and_log(cc + ['-flags'])

View File

@ -20,7 +20,6 @@ def find_sxx(conf):
if not cc: cc = conf.find_program('CC', var='CXX') #studio
if not cc: cc = conf.find_program('c++', var='CXX')
if not cc: conf.fatal('Could not find a Sun C++ compiler')
cc = conf.cmd_to_list(cc)
try:
conf.cmd_and_log(cc + ['-flags'])

View File

@ -14,7 +14,6 @@ def find_xlc(conf):
Detect the Aix C compiler
"""
cc = conf.find_program(['xlc_r', 'xlc'], var='CC')
cc = conf.cmd_to_list(cc)
conf.get_xlc_version(cc)
conf.env.CC_NAME = 'xlc'
conf.env.CC = cc

View File

@ -14,7 +14,6 @@ def find_xlcxx(conf):
Detect the Aix C++ compiler
"""
cxx = conf.find_program(['xlc++_r', 'xlc++'], var='CXX')
cxx = conf.cmd_to_list(cxx)
conf.get_xlc_version(cxx)
conf.env.CXX_NAME = 'xlc++'
conf.env.CXX = cxx

View File

@ -13,7 +13,6 @@ c_compiler['linux'].insert(0, 'c_bgxlc')
@conf
def find_bgxlc(conf):
cc = conf.find_program(['bgxlc_r','bgxlc'], var='CC')
cc = conf.cmd_to_list(cc)
conf.get_xlc_version(cc)
conf.env.CC = cc
conf.env.CC_NAME = 'bgxlc'

View File

@ -9,21 +9,16 @@ from waflib.Configure import conf
@conf
def find_dcc(conf):
cc = conf.find_program(['dcc'], var='CC', path_list=getattr(Options.options, 'diabbindir', ""))
cc = conf.cmd_to_list(cc)
conf.env.CC_NAME = 'dcc'
conf.env.CC = cc
@conf
def find_dld(conf):
ld = conf.find_program(['dld'], var='LINK_CC', path_list=getattr(Options.options, 'diabbindir', ""))
ld = conf.cmd_to_list(ld)
conf.env.LINK_CC_NAME = 'dld'
conf.env.LINK_CC = ld
@conf
def find_dar(conf):
ar = conf.find_program(['dar'], var='DAR', path_list=getattr(Options.options, 'diabbindir', ""))
ar = conf.cmd_to_list(ar)
conf.env.AR = ar
conf.env.AR_NAME = 'dar'
conf.env.ARFLAGS = 'rcs'
@ -31,8 +26,6 @@ def find_dar(conf):
@conf
def find_ddump(conf):
prg = conf.find_program(['ddump'], var='DDUMP', path_list=getattr(Options.options, 'diabbindir', ""))
prg = conf.cmd_to_list(prg)
conf.env.DDUMP = prg
@conf
def dcc_common_flags(conf):

View File

@ -12,7 +12,6 @@ fc_compiler['linux'].insert(0, 'fc_bgxlf')
@conf
def find_bgxlf(conf):
fc = conf.find_program(['bgxlf2003_r','bgxlf2003'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_xlf_version(fc)
conf.env.FC_NAME = 'BGXLF'

View File

@ -14,7 +14,6 @@ fc_compiler['linux'].append('fc_cray')
def find_crayftn(conf):
"""Find the Cray fortran compiler (will look in the environment variable 'FC')"""
fc = conf.find_program(['crayftn'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_crayftn_version(fc)
conf.env.FC_NAME = 'CRAY'
conf.env.FC_MOD_CAPITALIZATION = 'UPPER.mod'

View File

@ -15,7 +15,6 @@ def find_nag(conf):
"""Find the NAG Fortran Compiler (will look in the environment variable 'FC')"""
fc = conf.find_program(['nagfor'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_nag_version(fc)
conf.env.FC_NAME = 'NAG'
conf.env.FC_MOD_CAPITALIZATION = 'lower'

View File

@ -15,7 +15,6 @@ def find_openf95(conf):
"""Find the Open64 Fortran Compiler (will look in the environment variable 'FC')"""
fc = conf.find_program(['openf95', 'openf90'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_open64_version(fc)
conf.env.FC_NAME = 'OPEN64'
conf.env.FC_MOD_CAPITALIZATION = 'UPPER.mod'

View File

@ -14,7 +14,6 @@ fc_compiler['linux'].append('fc_pgfortran')
def find_pgfortran(conf):
"""Find the PGI fortran compiler (will look in the environment variable 'FC')"""
fc = conf.find_program(['pgfortran', 'pgf95', 'pgf90'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_pgfortran_version(fc)
conf.env.FC_NAME = 'PGFC'

View File

@ -15,7 +15,6 @@ def find_solstudio(conf):
"""Find the Solaris Studio compiler (will look in the environment variable 'FC')"""
fc = conf.find_program(['sunf95', 'f95', 'sunf90', 'f90'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_solstudio_version(fc)
conf.env.FC_NAME = 'SOL'

View File

@ -15,7 +15,6 @@ def find_xlf(conf):
"""Find the xlf program (will look in the environment variable 'FC')"""
fc = conf.find_program(['xlf2003_r', 'xlf2003', 'xlf95_r', 'xlf95', 'xlf90_r', 'xlf90', 'xlf_r', 'xlf'], var='FC')
fc = conf.cmd_to_list(fc)
conf.get_xlf_version(fc)
conf.env.FC_NAME='XLF'

View File

@ -56,7 +56,6 @@ def configure(conf):
Find a F# compiler, set the variable FSC for the compiler and FS_NAME (mono or fsc)
"""
conf.find_program(['fsc.exe', 'fsharpc'], var='FSC')
conf.env.FSC = conf.cmd_to_list(conf.env.FSC)
conf.env.ASS_ST = '/r:%s'
conf.env.RES_ST = '/resource:%s'

View File

@ -25,7 +25,6 @@ def find_pgi_compiler(conf, var, name):
elif var in conf.environ: cc = conf.environ[var]
if not cc: cc = conf.find_program(name, var=var)
if not cc: conf.fatal('PGI Compiler (%s) was not found' % name)
cc = conf.cmd_to_list(cc)
v[var + '_VERSION'] = conf.get_pgi_version(cc)
v[var] = cc

View File

@ -117,11 +117,10 @@ class rst2html(docutils):
return nodes, names
def run(self):
rst2x = self.generator.env.RST2HTML
src = self.inputs[0].bldpath()
dst = self.outputs[0].bldpath()
cmd = [rst2x]
cmd = self.generator.env.RST2HTML
cmd += Utils.to_list(getattr(self.generator, 'options', []))
stylesheet = getattr(self.generator, 'stylesheet', None)
if stylesheet is not None:
@ -134,11 +133,10 @@ class rst2html(docutils):
class rst2pdf(docutils):
color = 'BLUE'
def run(self):
rst2x = self.generator.env.RST2PDF
src = self.inputs[0].bldpath()
dst = self.outputs[0].bldpath()
cmd = [rst2x, src, '-o', dst]
cmd = self.generator.env.RST2PDF + [src, '-o', dst]
cmd += Utils.to_list(getattr(self.generator, 'options', []))
return self.exec_command(cmd)
@ -146,11 +144,10 @@ class rst2pdf(docutils):
class rst2latex(docutils):
color = 'BLUE'
def run(self):
rst2x = self.generator.env.RST2LATEX
src = self.inputs[0].bldpath()
dst = self.outputs[0].bldpath()
cmd = [rst2x, src, dst]
cmd = self.generator.env.RST2LATEX + [rst2x, src, dst]
cmd += Utils.to_list(getattr(self.generator, 'options', []))
return self.exec_command(cmd)

View File

@ -120,7 +120,6 @@ def configure(self):
for x in 'scalac scala'.split():
self.find_program(x, var=x.upper(), path_list=java_path)
self.env[x.upper()] = self.cmd_to_list(self.env[x.upper()])
if 'CLASSPATH' in self.environ:
v['CLASSPATH'] = self.environ['CLASSPATH']

View File

@ -44,22 +44,16 @@ opj = os.path.join
@conf
def find_ticc(conf):
cc = conf.find_program(['cl6x'], var='CC', path_list=opj(getattr(Options.options, 'ti-cgt-dir', ""), 'bin'))
cc = conf.cmd_to_list(cc)
conf.env.CC_NAME = 'ticc'
conf.env.CC = cc
@conf
def find_tild(conf):
ld = conf.find_program(['lnk6x'], var='LINK_CC', path_list=opj(getattr(Options.options, 'ti-cgt-dir', ""), 'bin'))
ld = conf.cmd_to_list(ld)
conf.env.LINK_CC_NAME = 'tild'
conf.env.LINK_CC = ld
@conf
def find_tiar(conf):
ar = conf.find_program(['ar6x'], var='AR', path_list=opj(getattr(Options.options, 'ti-cgt-dir', ""), 'bin'))
ar = conf.cmd_to_list(ar)
conf.env.AR = ar
conf.env.AR_NAME = 'tiar'
conf.env.ARFLAGS = 'qru'
@ -99,7 +93,7 @@ def configure(conf):
conf.cc_load_tools()
conf.cc_add_flags()
conf.link_add_flags()
v.TCONF = conf.cmd_to_list(conf.find_program(['tconf'], var='TCONF', path_list=v.TI_XDCTOOLS_DIR))
conf.find_program(['tconf'], var='TCONF', path_list=v.TI_XDCTOOLS_DIR)
conf.env.TCONF_INCLUDES += [
opj(conf.env.TI_DSPBIOS_DIR, 'packages'),