Upgrade to WAF 1.5.4
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Mon, 13 Apr 2009 23:10:37 +0100
changeset 4326179f86838e62
parent 4314 280cfa81fa8f
child 4327 85fa469a8ecf
Upgrade to WAF 1.5.4
bindings/python/waf
bindings/python/wscript
regression.py
src/wscript
waf
wscript
wutils.py
     1.1 --- a/bindings/python/wscript	Thu Apr 09 15:17:28 2009 +0100
     1.2 +++ b/bindings/python/wscript	Mon Apr 13 23:10:37 2009 +0100
     1.3 @@ -273,7 +273,7 @@
     1.4  
     1.5      def apply(self):
     1.6          ## get all of the ns3 headers
     1.7 -        ns3_dir_node = Build.bld.path.find_dir("ns3")
     1.8 +        ns3_dir_node = self.bld.path.find_dir("ns3")
     1.9          all_headers_inputs = []
    1.10  
    1.11          for filename in self.to_list(self.source):
    1.12 @@ -284,7 +284,7 @@
    1.13  
    1.14          ## if self.source was empty, include all ns3 headers in enabled modules
    1.15          if not all_headers_inputs:
    1.16 -            for ns3headers in Build.bld.all_task_gen:
    1.17 +            for ns3headers in self.bld.all_task_gen:
    1.18                  if type(ns3headers).__name__ == 'ns3header_taskgen': # XXX: find less hackish way to compare
    1.19                      ## skip headers not part of enabled modules
    1.20                      if self.env['NS3_ENABLED_MODULES']:
    1.21 @@ -307,7 +307,7 @@
    1.22          pass
    1.23  
    1.24  
    1.25 -def get_modules_and_headers():
    1.26 +def get_modules_and_headers(bld):
    1.27      """
    1.28      Gets a dict of
    1.29         module_name => ([module_dep1, module_dep2, ...], [module_header1, module_header2, ...])
    1.30 @@ -315,13 +315,13 @@
    1.31      """
    1.32  
    1.33      retval = {}
    1.34 -    for module in Build.bld.all_task_gen:
    1.35 +    for module in bld.all_task_gen:
    1.36          if not module.name.startswith('ns3-'):
    1.37              continue
    1.38          module_name = module.name[4:] # strip the ns3- prefix
    1.39          ## find the headers object for this module
    1.40          headers = []
    1.41 -        for ns3headers in Build.bld.all_task_gen:
    1.42 +        for ns3headers in bld.all_task_gen:
    1.43              if type(ns3headers).__name__ != 'ns3header_taskgen': # XXX: find less hackish way to compare
    1.44                  continue
    1.45              if ns3headers.module != module_name:
    1.46 @@ -338,8 +338,9 @@
    1.47      """
    1.48      after = 'gen_everything_h_task'
    1.49      before = 'cc cxx'
    1.50 -    def __init__(self, curdirnode, env):
    1.51 -        super(python_scan_task, self).__init__()
    1.52 +    def __init__(self, curdirnode, env, bld):
    1.53 +        self.bld = bld
    1.54 +        super(python_scan_task, self).__init__(generator=self)
    1.55          self.curdirnode = curdirnode
    1.56          self.env = env
    1.57  
    1.58 @@ -356,7 +357,7 @@
    1.59              os.path.join(self.curdirnode.abspath(), 'ns3modulegen_generated.py'), # output file
    1.60              ]
    1.61          scan = subprocess.Popen(argv, stdin=subprocess.PIPE)
    1.62 -        scan.stdin.write(repr(get_modules_and_headers()))
    1.63 +        scan.stdin.write(repr(get_modules_and_headers(self.bld)))
    1.64          scan.stdin.close()
    1.65          retval = scan.wait()
    1.66          print "Scan finished with exit code", retval
    1.67 @@ -365,7 +366,7 @@
    1.68          # signal stop (we generated files into the source dir and WAF
    1.69          # can't cope with it, so we have to force the user to restart
    1.70          # WAF)
    1.71 -        Build.bld.generator.stop = 1
    1.72 +        self.bld.generator.stop = 1
    1.73          return 0
    1.74  
    1.75  
    1.76 @@ -384,7 +385,7 @@
    1.77      if Options.options.python_scan:
    1.78          if not env['ENABLE_PYTHON_SCANNING']:
    1.79              raise Utils.WafError("Cannot re-scan python bindings: (py)gccxml not available")
    1.80 -        python_scan_task(bld.path, env)
    1.81 +        python_scan_task(bld.path, env, bld)
    1.82          return
    1.83  
    1.84      ## Get a list of scanned modules; the set of scanned modules
    1.85 @@ -412,7 +413,7 @@
    1.86              'ns3modulegen.log',
    1.87              ]
    1.88          argv = ['NS3_ENABLED_FEATURES=${FEATURES}', '${PYTHON}', '${SRC[0]}', '${TGT[0]}']
    1.89 -        argv.extend(get_modules_and_headers().iterkeys())
    1.90 +        argv.extend(get_modules_and_headers(bld).iterkeys())
    1.91          for module in scanned_modules:
    1.92              source.append("ns3_module_%s.py" % module)
    1.93              local = "ns3_module_%s__local.py" % module
    1.94 @@ -434,12 +435,8 @@
    1.95          bindgen.dep_vars = ['FEATURES']
    1.96          bindgen.before = 'cxx'
    1.97          bindgen.after = 'gen_everything_h_task'
    1.98 +        bindgen.name = "pybindgen-command"
    1.99  
   1.100 -    ## we build python bindings if either we have the tools to
   1.101 -    ## generate them or if the pregenerated source file is already
   1.102 -    ## present in the source dir.
   1.103 -    if env['ENABLE_PYTHON_BINDINGS'] \
   1.104 -            or os.path.exists(os.path.join(bld.path.abspath(), 'ns3module.cc')):
   1.105          pymod = bld.new_task_gen('cxx', 'shlib', 'pyext')
   1.106          pymod.source = ['ns3module.cc', 'ns3module_helpers.cc']
   1.107          pymod.includes = '.'
     2.1 --- a/regression.py	Thu Apr 09 15:17:28 2009 +0100
     2.2 +++ b/regression.py	Mon Apr 13 23:10:37 2009 +0100
     2.3 @@ -6,7 +6,6 @@
     2.4  import errno
     2.5  
     2.6  # WAF modules
     2.7 -import Build
     2.8  import Options
     2.9  import Utils
    2.10  import Task
    2.11 @@ -66,9 +65,11 @@
    2.12      after = 'cc cxx cc_link cxx_link'
    2.13      color = 'BLUE'
    2.14  
    2.15 -    def __init__(self, env, test_name, test_scripts_dir, build_traces_dir, reference_traces):
    2.16 -        super(regression_test_task, self).__init__()
    2.17 +    def __init__(self, bld, env, test_name, test_scripts_dir, build_traces_dir, reference_traces):
    2.18 +        self.bld = bld
    2.19 +        self.generator = self
    2.20          self.env = env
    2.21 +        super(regression_test_task, self).__init__(generator=self, env=env)
    2.22          self.test_name = test_name
    2.23          self.test_scripts_dir = test_scripts_dir
    2.24          self.build_traces_dir = build_traces_dir
    2.25 @@ -77,6 +78,9 @@
    2.26      def __str__(self):
    2.27          return 'regression-test (%s)\n' % self.test_name
    2.28  
    2.29 +    def runnable_status(self):
    2.30 +        return Task.RUN_ME
    2.31 +
    2.32      def run(self):
    2.33          """Run a single test"""
    2.34          sys.path.insert(0, self.test_scripts_dir)
    2.35 @@ -119,7 +123,7 @@
    2.36          if Options.options.regression_generate:
    2.37              # clean the target dir
    2.38              try:
    2.39 -                shutil.rmtree(trace_output_path)
    2.40 +                shutil.rmtree(reference_traces_path)
    2.41              except OSError, ex:
    2.42                  if ex.errno not in [errno.ENOENT]:
    2.43                      raise
    2.44 @@ -206,13 +210,17 @@
    2.45      after = 'regression_test_task'
    2.46      color = 'BLUE'
    2.47  
    2.48 -    def __init__(self, test_tasks):
    2.49 -        super(regression_test_collector_task, self).__init__()
    2.50 +    def __init__(self, bld, test_tasks):
    2.51 +        self.bld = bld
    2.52 +        super(regression_test_collector_task, self).__init__(generator=self)
    2.53          self.test_tasks = test_tasks
    2.54  
    2.55      def __str__(self):
    2.56          return 'regression-test-collector\n'
    2.57  
    2.58 +    def runnable_status(self):
    2.59 +        return Task.RUN_ME
    2.60 +
    2.61      def run(self):
    2.62          failed_tests = [test for test in self.test_tasks if test.result is not None and test.result != 0]
    2.63          skipped_tests = [test for test in self.test_tasks if test.result is None]
    2.64 @@ -256,5 +264,7 @@
    2.65      build_traces_dir = bld.path.find_or_declare('regression/traces').abspath(bld.env)
    2.66      tasks = []
    2.67      for test in tests:
    2.68 -        tasks.append(regression_test_task(bld.env, test, test_scripts_dir, build_traces_dir, reference_traces))
    2.69 -    regression_test_collector_task(tasks)
    2.70 +        task = regression_test_task(bld, bld.env, test, test_scripts_dir, build_traces_dir, reference_traces)
    2.71 +        #bld.task_manager.add_task(task)
    2.72 +        tasks.append(task)
    2.73 +    regression_test_collector_task(bld, tasks)
     3.1 --- a/src/wscript	Thu Apr 09 15:17:28 2009 +0100
     3.2 +++ b/src/wscript	Mon Apr 13 23:10:37 2009 +0100
     3.3 @@ -9,8 +9,7 @@
     3.4  import Task
     3.5  import Options
     3.6  import Build
     3.7 -from Utils import md5
     3.8 -
     3.9 +import Utils
    3.10  
    3.11  all_modules = (
    3.12      'core',
    3.13 @@ -109,7 +108,7 @@
    3.14      def apply(self):
    3.15          if self.module is None:
    3.16              raise Utils.WafError("'module' missing on ns3headers object %s" % self)
    3.17 -        ns3_dir_node = Build.bld.path.find_dir("ns3")
    3.18 +        ns3_dir_node = self.bld.path.find_dir("ns3")
    3.19          if self.sub_dir is not None:
    3.20              ns3_dir_node = ns3_dir_node.find_dir(self.sub_dir)
    3.21          for filename in self.to_list(self.source):
    3.22 @@ -176,7 +175,7 @@
    3.23          return 0
    3.24  
    3.25      def sig_explicit_deps(self):
    3.26 -        m = md5()
    3.27 +        m = Utils.md5()
    3.28          m.update('\n'.join([node.abspath(self.env) for node in self.inputs]))
    3.29          return m.digest()
    3.30  
    3.31 @@ -185,7 +184,7 @@
    3.32              return self.uid
    3.33          except AttributeError:
    3.34              "this is not a real hot zone, but we want to avoid surprizes here"
    3.35 -            m = md5()
    3.36 +            m = Utils.md5()
    3.37              m.update("ns-3-module-header-%s" % self.module)
    3.38              self.uid = m.digest()
    3.39              return self.uid
    3.40 @@ -199,13 +198,12 @@
    3.41      COLOR = 'BLUE'
    3.42      def __init__(self, *args, **kwargs):
    3.43          super(ns3moduleheader_taskgen, self).__init__(*args, **kwargs)
    3.44 -        self.module_name = None
    3.45  
    3.46      def apply(self):
    3.47          ## get all of the ns3 headers
    3.48 -        ns3_dir_node = Build.bld.path.find_dir("ns3")
    3.49 +        ns3_dir_node = self.bld.path.find_dir("ns3")
    3.50          all_headers_inputs = []
    3.51 -        for ns3headers in Build.bld.all_task_gen:
    3.52 +        for ns3headers in self.bld.all_task_gen:
    3.53              if isinstance(ns3headers, ns3header_taskgen):
    3.54                  if ns3headers.module != self.module:
    3.55                      continue
    3.56 @@ -215,8 +213,10 @@
    3.57                      if node is None:
    3.58                          fatal("missing header file %s" % (source,))
    3.59                      all_headers_inputs.append(node)
    3.60 +        if not all_headers_inputs:
    3.61 +            raise Utils.WscriptError("error finding headers for module %s" % self.module)
    3.62          assert all_headers_inputs
    3.63 -        module_obj = Build.bld.name_to_obj("ns3-" + self.module, self.env)
    3.64 +        module_obj = self.bld.name_to_obj("ns3-" + self.module, self.env)
    3.65          assert module_obj is not None
    3.66          all_headers_outputs = [ns3_dir_node.find_or_declare("%s-module.h" % self.module)]
    3.67          task = self.create_task('gen_ns3_module_header', self.env)
     4.1 Binary file waf has changed
     5.1 --- a/wscript	Thu Apr 09 15:17:28 2009 +0100
     5.2 +++ b/wscript	Mon Apr 13 23:10:37 2009 +0100
     5.3 @@ -10,6 +10,7 @@
     5.4  # WAF modules
     5.5  import pproc as subprocess
     5.6  import Options
     5.7 +
     5.8  import Logs
     5.9  import TaskGen
    5.10  import Constants
    5.11 @@ -23,6 +24,7 @@
    5.12  import Utils
    5.13  import Build
    5.14  import Configure
    5.15 +import Scripting
    5.16  
    5.17  import cflags # override the build profiles from waf
    5.18  cflags.profiles = {
    5.19 @@ -133,7 +135,7 @@
    5.20                     action="store_true", default=False,
    5.21                     dest='valgrind')
    5.22      opt.add_option('--shell',
    5.23 -                   help=('Run a shell with an environment suitably modified to run locally built programs'),
    5.24 +                   help=('DEPRECATED (run ./waf shell)'),
    5.25                     action="store_true", default=False,
    5.26                     dest='shell')
    5.27      opt.add_option('--enable-sudo',
    5.28 @@ -161,7 +163,7 @@
    5.29      opt.sub_options('src/internet-stack')
    5.30  
    5.31  
    5.32 -def check_compilation_flag(conf, flag):
    5.33 +def _check_compilation_flag(conf, flag):
    5.34      """
    5.35      Checks if the C++ compiler accepts a certain compilation flag or flags
    5.36      flag: can be a string or a list of strings
    5.37 @@ -186,7 +188,7 @@
    5.38  
    5.39  def configure(conf):
    5.40      # attach some extra methods
    5.41 -    conf.check_compilation_flag = types.MethodType(check_compilation_flag, conf)
    5.42 +    conf.check_compilation_flag = types.MethodType(_check_compilation_flag, conf)
    5.43      conf.report_optional_feature = types.MethodType(report_optional_feature, conf)
    5.44      conf.env['NS3_OPTIONAL_FEATURES'] = []
    5.45  
    5.46 @@ -235,7 +237,7 @@
    5.47      env.append_value('CXXDEFINES', 'RUN_SELF_TESTS')
    5.48      
    5.49      if env['COMPILER_CXX'] == 'g++' and 'CXXFLAGS' not in os.environ:
    5.50 -        if check_compilation_flag(conf, '-Wno-error=deprecated-declarations'):
    5.51 +        if conf.check_compilation_flag('-Wno-error=deprecated-declarations'):
    5.52              env.append_value('CXXFLAGS', '-Wno-error=deprecated-declarations')
    5.53          
    5.54      if Options.options.build_profile == 'debug':
    5.55 @@ -363,6 +365,7 @@
    5.56  
    5.57  
    5.58  def build(bld):
    5.59 +    wutils.bld = bld
    5.60      if Options.options.no_task_lines:
    5.61          import Runner
    5.62          def null_printout(s):
    5.63 @@ -378,21 +381,6 @@
    5.64      variant_env = bld.env_of_name(variant_name)
    5.65      bld.all_envs['default'] = variant_env
    5.66  
    5.67 -    if Options.options.shell:
    5.68 -        run_shell()
    5.69 -        raise SystemExit(0)
    5.70 -
    5.71 -    if Options.options.doxygen:
    5.72 -        doxygen()
    5.73 -        raise SystemExit(0)
    5.74 -
    5.75 -    check_shell()
    5.76 -
    5.77 -    if Options.options.doxygen:
    5.78 -        doxygen()
    5.79 -        raise SystemExit(0)
    5.80 -
    5.81 -    print "Entering directory `%s'" % os.path.join(bld.path.abspath(), 'build')
    5.82      # process subfolders from here
    5.83      bld.add_subdirs('src')
    5.84      bld.add_subdirs('samples utils examples')
    5.85 @@ -427,14 +415,14 @@
    5.86                          changed = True
    5.87  
    5.88          ## remove objects that depend on modules not listed
    5.89 -        for obj in list(Build.bld.all_task_gen):
    5.90 +        for obj in list(bld.all_task_gen):
    5.91              if hasattr(obj, 'ns3_module_dependencies'):
    5.92                  for dep in obj.ns3_module_dependencies:
    5.93                      if dep not in modules:
    5.94 -                        Build.bld.all_task_gen.remove(obj)
    5.95 +                        bld.all_task_gen.remove(obj)
    5.96                          break
    5.97              if obj.name in env['NS3_MODULES'] and obj.name not in modules:
    5.98 -                Build.bld.all_task_gen.remove(obj)
    5.99 +                bld.all_task_gen.remove(obj)
   5.100  
   5.101      ## Create a single ns3 library containing all enabled modules
   5.102      lib = bld.new_task_gen('cxx', 'shlib')
   5.103 @@ -468,11 +456,13 @@
   5.104          regression.run_regression(bld, regression_traces)
   5.105  
   5.106  
   5.107 -def shutdown():
   5.108 -    env = Build.bld.env
   5.109  
   5.110 -    if Options.commands['check']:
   5.111 -        _run_waf_check()
   5.112 +def shutdown(ctx):
   5.113 +    bld = wutils.bld
   5.114 +    env = bld.env
   5.115 +
   5.116 +    #if Options.commands['check']:
   5.117 +    #    _run_waf_check()
   5.118  
   5.119      if Options.options.lcov_report:
   5.120          lcov_report()
   5.121 @@ -485,9 +475,26 @@
   5.122          wutils.run_python_program(Options.options.pyrun)
   5.123          raise SystemExit(0)
   5.124  
   5.125 -def _run_waf_check():
   5.126 +    if Options.options.shell:
   5.127 +        raise Utils.WafError("Run `./waf shell' now, instead of `./waf shell'")
   5.128 +
   5.129 +    if Options.options.doxygen:
   5.130 +        doxygen()
   5.131 +        raise SystemExit(0)
   5.132 +
   5.133 +    check_shell(bld)
   5.134 +
   5.135 +    if Options.options.doxygen:
   5.136 +        doxygen()
   5.137 +        raise SystemExit(0)
   5.138 +
   5.139 +
   5.140 +check_context = Build.BuildContext
   5.141 +def check(bld):
   5.142 +    "run the NS-3 unit tests"
   5.143 +    Scripting.build(bld)
   5.144      ## generate the trace sources list docs
   5.145 -    env = Build.bld.env
   5.146 +    env = bld.env
   5.147      proc_env = wutils.get_proc_env()
   5.148      try:
   5.149          program_obj = wutils.find_program('print-introspected-doxygen', env)
   5.150 @@ -514,14 +521,14 @@
   5.151  
   5.152  
   5.153  
   5.154 -def check_shell():
   5.155 +def check_shell(bld):
   5.156      if 'NS3_MODULE_PATH' not in os.environ:
   5.157          return
   5.158 -    env = Build.bld.env
   5.159 +    env = bld.env
   5.160      correct_modpath = os.pathsep.join(env['NS3_MODULE_PATH'])
   5.161      found_modpath = os.environ['NS3_MODULE_PATH']
   5.162      if found_modpath != correct_modpath:
   5.163 -        msg = ("Detected shell (waf --shell) with incorrect configuration\n"
   5.164 +        msg = ("Detected shell (./waf shell) with incorrect configuration\n"
   5.165                 "=========================================================\n"
   5.166                 "Possible reasons for this problem:\n"
   5.167                 "  1. You switched to another ns-3 tree from inside this shell\n"
   5.168 @@ -533,13 +540,19 @@
   5.169          raise Utils.WafError(msg)
   5.170  
   5.171  
   5.172 -def run_shell():
   5.173 +shell_context = Build.BuildContext
   5.174 +def shell(ctx):
   5.175 +    """run a shell with an environment suitably modified to run locally built programs"""
   5.176 +
   5.177 +    #make sure we build first"
   5.178 +    Scripting.build(ctx)
   5.179 +
   5.180      if sys.platform == 'win32':
   5.181          shell = os.environ.get("COMSPEC", "cmd.exe")
   5.182      else:
   5.183          shell = os.environ.get("SHELL", "/bin/sh")
   5.184  
   5.185 -    env = Build.bld.env
   5.186 +    env = wutils.bld.env
   5.187      wutils.run_argv([shell], {'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH'])})
   5.188  
   5.189  def doxygen():
   5.190 @@ -598,7 +611,7 @@
   5.191  import Utils
   5.192  import os
   5.193  
   5.194 -def copytree(src, dst, symlinks=False, excludes=(), build_dir=None):
   5.195 +def _copytree(src, dst, symlinks=False, excludes=(), build_dir=None):
   5.196      """Recursively copy a directory tree using copy2().
   5.197  
   5.198      The destination directory must not already exist.
   5.199 @@ -668,7 +681,7 @@
   5.200  
   5.201  
   5.202  def DistDir(appname, version):
   5.203 -    "make a distribution directory with all the sources in it"
   5.204 +    #"make a distribution directory with all the sources in it"
   5.205      import shutil
   5.206  
   5.207      # Our temporary folder where to put our files
   5.208 @@ -683,7 +696,7 @@
   5.209      build_dir = getattr(Utils.g_module, BLDDIR, None)
   5.210  
   5.211      # Copy everything into the new folder
   5.212 -    copytree('.', TMPFOLDER, excludes=excludes, build_dir=build_dir)
   5.213 +    _copytree('.', TMPFOLDER, excludes=excludes, build_dir=build_dir)
   5.214  
   5.215      # TODO undocumented hook
   5.216      dist_hook = getattr(Utils.g_module, 'dist_hook', None)
     6.1 --- a/wutils.py	Thu Apr 09 15:17:28 2009 +0100
     6.2 +++ b/wutils.py	Mon Apr 13 23:10:37 2009 +0100
     6.3 @@ -16,6 +16,7 @@
     6.4  # these are set from the main wscript file
     6.5  APPNAME=None
     6.6  VERSION=None
     6.7 +bld=None
     6.8  
     6.9  #
    6.10  # The last part of the path name to use to find the regression traces tarball.
    6.11 @@ -65,7 +66,7 @@
    6.12      launch_dir = os.path.abspath(Options.cwd_launch)
    6.13      top_dir = os.path.abspath(Options.launch_dir)
    6.14      found_programs = []
    6.15 -    for obj in Build.bld.all_task_gen:
    6.16 +    for obj in bld.all_task_gen:
    6.17          if not getattr(obj, 'is_ns3_program', False):
    6.18              continue
    6.19  
    6.20 @@ -84,7 +85,7 @@
    6.21                       % (program_name, found_programs))
    6.22  
    6.23  def get_proc_env(os_env=None):
    6.24 -    env = Build.bld.env
    6.25 +    env = bld.env
    6.26      if sys.platform == 'linux2':
    6.27          pathvar = 'LD_LIBRARY_PATH'
    6.28      elif sys.platform == 'darwin':
    6.29 @@ -111,7 +112,7 @@
    6.30          else:
    6.31              proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']))
    6.32  
    6.33 -    pymoddir = Build.bld.path.find_dir('bindings/python').abspath(env)
    6.34 +    pymoddir = bld.path.find_dir('bindings/python').abspath(env)
    6.35      if 'PYTHONPATH' in proc_env:
    6.36          proc_env['PYTHONPATH'] = os.pathsep.join([pymoddir] + [proc_env['PYTHONPATH']])
    6.37      else:
    6.38 @@ -121,7 +122,6 @@
    6.39  
    6.40  def run_argv(argv, os_env=None, cwd=None):
    6.41      proc_env = get_proc_env(os_env)
    6.42 -    #env = Build.bld.env
    6.43      retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
    6.44      if retval:
    6.45          raise Utils.WafError("Command %s exited with code %i" % (argv, retval))
    6.46 @@ -133,7 +133,7 @@
    6.47      run_program(program_string, command_template).
    6.48      """
    6.49      #print "get_run_program_argv(program_string=%r, command_template=%r)" % (program_string, command_template)
    6.50 -    env = Build.bld.env
    6.51 +    env = bld.env
    6.52  
    6.53      if command_template in (None, '%s'):
    6.54          argv = shlex.split(program_string)
    6.55 @@ -187,7 +187,7 @@
    6.56  
    6.57  
    6.58  def run_python_program(program_string):
    6.59 -    env = Build.bld.env
    6.60 +    env = bld.env
    6.61      execvec = shlex.split(program_string)
    6.62      if (Options.options.cwd_launch):
    6.63          cwd = Options.options.cwd_launch