WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sat Apr 26 21:54:36 2008 +0100 (21 months ago)
changeset 3001f7aa2796627f
parent 2990 69ddc1c42130
child 3002 3f851016493d
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
src/wscript
waf
wscript
     1.1 --- a/src/wscript	Mon Apr 21 17:31:01 2008 +0100
     1.2 +++ b/src/wscript	Sat Apr 26 21:54:36 2008 +0100
     1.3 @@ -69,33 +69,27 @@
     1.4      
     1.5  
     1.6  def build(bld):
     1.7 -    Object.register('ns3header', Ns3Header)
     1.8 +    #Object.register('ns3header', Ns3Header)
     1.9      Action.Action('ns3header', func=_ns3_headers_inst, color='BLUE')
    1.10 -    Object.register('ns3-module-header', Ns3ModuleHeader)
    1.11 +    #Object.register('ns3-module-header', Ns3ModuleHeader)
    1.12      Action.Action('gen-ns3-module-header', func=gen_ns3_module_header, color='BLUE')
    1.13      bld.create_ns3_module = types.MethodType(create_ns3_module, bld)
    1.14      
    1.15      bld.add_subdirs(list(all_modules))
    1.16  
    1.17      for module in all_modules:
    1.18 -        modheader = bld.create_obj('ns3-module-header')
    1.19 +        modheader = bld.create_obj('ns3moduleheader')
    1.20          modheader.module = module.split('/')[-1]
    1.21  
    1.22  
    1.23 -class Ns3Header(Object.genobj):
    1.24 +class ns3header_taskgen(Object.task_gen):
    1.25      """A set of NS-3 header files"""
    1.26 -    def __init__(self, env=None):
    1.27 -        Object.genobj.__init__(self, 'ns3header')
    1.28 +    def __init__(self, *features):
    1.29 +        Object.task_gen.__init__(self, *features)
    1.30          self.inst_var = 'INCLUDEDIR'
    1.31          self.inst_dir = 'ns3'
    1.32          self.sub_dir = None # if not None, header files will be published as ns3/sub_dir/file.h
    1.33          self.module = None # module name
    1.34 -        self.env = env
    1.35 -        if not self.env:
    1.36 -            self.env = Params.g_build.m_allenvs['default']
    1.37 -
    1.38 -    def get_valid_types(self):
    1.39 -        return ['ns3header']
    1.40  
    1.41      def apply(self):
    1.42          if self.module is None:
    1.43 @@ -169,17 +163,13 @@
    1.44      return 0
    1.45  
    1.46  
    1.47 -class Ns3ModuleHeader(Object.genobj):
    1.48 +class ns3moduleheader_taskgen(Object.task_gen):
    1.49      """
    1.50      Generates a 'ns3/foo-module.h' header file that includes all
    1.51      public ns3 headers of a certain module.
    1.52      """
    1.53 -    def __init__(self, env=None):
    1.54 -        Object.genobj.__init__(self, 'other')
    1.55 -        self.install_var = 0
    1.56 -        self.env = env
    1.57 -        if not self.env:
    1.58 -            self.env = Params.g_build.m_allenvs['default'].copy()
    1.59 +    def __init__(self, *features):
    1.60 +        Object.task_gen.__init__(self, *features)
    1.61          self.module_name = None
    1.62  
    1.63      def apply(self):
    1.64 @@ -187,7 +177,7 @@
    1.65          ns3_dir_node = Params.g_build.m_srcnode.find_dir("ns3")
    1.66          all_headers_inputs = []
    1.67          for ns3headers in Object.g_allobjs:
    1.68 -            if ns3headers.m_type == 'ns3header':
    1.69 +            if isinstance(ns3headers, ns3header_taskgen):
    1.70                  if ns3headers.module != self.module:
    1.71                      continue
    1.72                  for source in ns3headers.to_list(ns3headers.source):
     2.1 --- a/waf	Mon Apr 21 17:31:01 2008 +0100
     2.2 +++ b/waf	Sat Apr 26 21:54:36 2008 +0100
     2.3 @@ -2,6 +2,9 @@
     2.4  # encoding: utf-8
     2.5  # Thomas Nagy, 2005-2008
     2.6  
     2.7 +raise RuntimeError("Sorry, this ns-3 branch temporarily requires WAF trunk (or 1.4.1);"
     2.8 +                   " I will update the WAF script later...")
     2.9 +
    2.10  """
    2.11  Redistribution and use in source and binary forms, with or without
    2.12  modification, are permitted provided that the following conditions
     3.1 --- a/wscript	Mon Apr 21 17:31:01 2008 +0100
     3.2 +++ b/wscript	Sat Apr 26 21:54:36 2008 +0100
     3.3 @@ -6,9 +6,11 @@
     3.4  import optparse
     3.5  import os.path
     3.6  
     3.7 +import pproc as subprocess
     3.8 +
     3.9  import Params
    3.10  import Object
    3.11 -import pproc as subprocess
    3.12 +import ccroot
    3.13  
    3.14  Params.g_autoconfig = 1
    3.15  
    3.16 @@ -218,6 +220,7 @@
    3.17  
    3.18  def create_ns3_program(bld, name, dependencies=('simulator',)):
    3.19      program = bld.create_obj('cpp', 'program')
    3.20 +    program.is_ns3_program = True
    3.21      program.name = name
    3.22      program.target = program.name
    3.23      program.uselib_local = 'ns3'
    3.24 @@ -351,7 +354,7 @@
    3.25                         # --enable-modules=xxx
    3.26          pass
    3.27      else:
    3.28 -        prog = program_obj.path.find_build(program_obj.get_target_name()).abspath(env)
    3.29 +        prog = program_obj.path.find_build(ccroot.get_target_name(program_obj)).abspath(env)
    3.30          out = open('doc/introspected-doxygen.h', 'w')
    3.31          if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
    3.32              raise SystemExit(1)
    3.33 @@ -359,12 +362,11 @@
    3.34  
    3.35      run_program('run-tests', get_command_template())
    3.36  
    3.37 -
    3.38  def _find_program(program_name, env):
    3.39      launch_dir = os.path.abspath(Params.g_cwd_launch)
    3.40      found_programs = []
    3.41      for obj in Object.g_allobjs:
    3.42 -        if obj.m_type != 'program' or not obj.target:
    3.43 +        if not getattr(obj, 'is_ns3_program', False):
    3.44              continue
    3.45  
    3.46          ## filter out programs not in the subtree starting at the launch dir
    3.47 @@ -430,7 +432,7 @@
    3.48              Params.fatal(str(ex))
    3.49  
    3.50          try:
    3.51 -            program_node = program_obj.path.find_build(program_obj.get_target_name())
    3.52 +            program_node = program_obj.path.find_build(ccroot.get_target_name(program_obj))
    3.53          except AttributeError:
    3.54              Params.fatal("%s does not appear to be a program" % (program_name,))
    3.55  
    3.56 @@ -444,7 +446,7 @@
    3.57          except ValueError, ex:
    3.58              Params.fatal(str(ex))
    3.59          try:
    3.60 -            program_node = program_obj.path.find_build(program_obj.get_target_name())
    3.61 +            program_node = program_obj.path.find_build(ccroot.get_target_name(program_obj))
    3.62          except AttributeError:
    3.63              Params.fatal("%s does not appear to be a program" % (program_name,))
    3.64