From 6c0685f4140bd0de7fdba7163cc7a4f8aefcde53 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sun, 5 Nov 2006 00:56:27 +0000 Subject: [PATCH] (merge from head) Add "--default-bjam" option to force using bjam present in the system (ie the search path). [SVN r35846] --- v2/test/BoostBuild.py | 113 ++++++++++++++++++++++-------------------- v2/test/TestCmd.py | 18 +++++-- 2 files changed, 74 insertions(+), 57 deletions(-) diff --git a/v2/test/BoostBuild.py b/v2/test/BoostBuild.py index 2e7c10ad8..a1aff2cba 100644 --- a/v2/test/BoostBuild.py +++ b/v2/test/BoostBuild.py @@ -110,73 +110,77 @@ class Tester(TestCmd.TestCmd): self.toolset = get_toolset() self.pass_toolset = pass_toolset - + prepare_suffix_map(pass_toolset and self.toolset or 'gcc') - jam_build_dir = "" - if os.name == 'nt': - jam_build_dir = "bin.ntx86" - elif os.name == 'posix' and os.__dict__.has_key('uname'): - if os.uname()[0].lower().startswith('cygwin'): - jam_build_dir = "bin.cygwinx86" - if 'TMP' in os.environ and os.environ['TMP'].find('~') != -1: - print 'Setting $TMP to /tmp to get around problem with short path names' - os.environ['TMP'] = '/tmp' - elif os.uname()[0] == 'Linux': - cpu = os.uname()[4] - if re.match("i.86", cpu): - jam_build_dir = "bin.linuxx86"; + if not '--default-bjam' in sys.argv: + jam_build_dir = "" + if os.name == 'nt': + jam_build_dir = "bin.ntx86" + elif os.name == 'posix' and os.__dict__.has_key('uname'): + if os.uname()[0].lower().startswith('cygwin'): + jam_build_dir = "bin.cygwinx86" + if 'TMP' in os.environ and os.environ['TMP'].find('~') != -1: + print 'Setting $TMP to /tmp to get around problem with short path names' + os.environ['TMP'] = '/tmp' + elif os.uname()[0] == 'Linux': + cpu = os.uname()[4] + if re.match("i.86", cpu): + jam_build_dir = "bin.linuxx86"; + else: + jam_build_dir = "bin.linux" + os.uname()[4] + elif os.uname()[0] == 'SunOS': + jam_build_dir = "bin.solaris" + elif os.uname()[0] == 'Darwin': + jam_build_dir = "bin.macosxppc" + elif os.uname()[0] == "AIX": + jam_build_dir = "bin.aix" + elif os.uname()[0] == "IRIX64": + jam_build_dir = "bin.irix" + elif os.uname()[0] == "FreeBSD": + jam_build_dir = "bin.freebsd" + elif os.uname()[0] == "OSF1": + jam_build_dir = "bin.osf" else: - jam_build_dir = "bin.linux" + os.uname()[4] - elif os.uname()[0] == 'SunOS': - jam_build_dir = "bin.solaris" - elif os.uname()[0] == 'Darwin': - jam_build_dir = "bin.macosxppc" - elif os.uname()[0] == "AIX": - jam_build_dir = "bin.aix" - elif os.uname()[0] == "IRIX64": - jam_build_dir = "bin.irix" - elif os.uname()[0] == "FreeBSD": - jam_build_dir = "bin.freebsd" - elif os.uname()[0] == "OSF1": - jam_build_dir = "bin.osf" + raise "Don't know directory where jam is build for this system: " + os.name + "/" + os.uname()[0] else: - raise "Don't know directory where jam is build for this system: " + os.name + "/" + os.uname()[0] - else: - raise "Don't know directory where jam is build for this system: " + os.name + raise "Don't know directory where jam is build for this system: " + os.name - if boost_build_path is None: - boost_build_path = self.original_workdir - + # Find there jam_src is located. + # try for the debug version if it's lying around + + dirs = [os.path.join('../../../jam/src', jam_build_dir + '.debug'), + os.path.join('../../../jam/src', jam_build_dir), + os.path.join('../../jam_src', jam_build_dir + '.debug'), + os.path.join('../../jam_src', jam_build_dir), + os.path.join('../jam_src', jam_build_dir + '.debug'), + os.path.join('../jam_src', jam_build_dir), + ] + + for d in dirs: + if os.path.exists(d): + jam_build_dir = d + break + else: + print "Cannot find built Boost.Jam" + os.exit(1) verbosity = ['-d0', '--quiet'] if '--verbose' in sys.argv: keywords['verbose'] = 1 verbosity = ['-d+2'] + if boost_build_path is None: + boost_build_path = self.original_workdir + program_list = [] - - # Find there jam_src is located. - # try for the debug version if it's lying around - - dirs = [os.path.join('../../../jam/src', jam_build_dir + '.debug'), - os.path.join('../../../jam/src', jam_build_dir), - os.path.join('../../jam_src', jam_build_dir + '.debug'), - os.path.join('../../jam_src', jam_build_dir), - os.path.join('../jam_src', jam_build_dir + '.debug'), - os.path.join('../jam_src', jam_build_dir), - ] - - for d in dirs: - if os.path.exists(d): - jam_build_dir = d - break - else: - print "Cannot find built Boost.Jam" - os.exit(1) - - program_list.append(os.path.join(jam_build_dir, executable)) + if '--default-bjam' in sys.argv: + program_list.append(executable) + inpath_bjam = True + else: + program_list.append(os.path.join(jam_build_dir, executable)) + inpath_bjam = None program_list.append('-sBOOST_BUILD_PATH=' + boost_build_path) if verbosity: program_list += verbosity @@ -188,6 +192,7 @@ class Tester(TestCmd.TestCmd): , program=program_list , match=match , workdir = workdir + , inpath = inpath_bjam , **keywords) os.chdir(self.workdir) diff --git a/v2/test/TestCmd.py b/v2/test/TestCmd.py index 6ccafc911..6096e7122 100644 --- a/v2/test/TestCmd.py +++ b/v2/test/TestCmd.py @@ -41,6 +41,14 @@ or incorrect permissions). # AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# Copyright 2002-2003 Vladimir Prus. +# Copyright 2002-2003 Dave Abrahams. +# Copyright 2006 Rene Rivera. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + from string import join, split __author__ = "Steven Knight " @@ -198,10 +206,14 @@ class TestCmd: workdir = None, subdir = None, verbose = 0, - match = None): + match = None, + inpath = None): self._cwd = os.getcwd() self.description_set(description) - self.program_set(program) + if inpath: + self.program = program + else: + self.program_set(program) self.interpreter_set(interpreter) self.verbose_set(verbose) if not match is None: @@ -392,7 +404,7 @@ class TestCmd: os.chdir(chdir) cmd = [] if program and program[0]: - if not os.path.isabs(program[0]): + if program[0] != self.program[0] and not os.path.isabs(program[0]): program[0] = os.path.join(self._cwd, program[0]) cmd += program # if interpreter: