Clean some dead waf code
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Mon, 12 Sep 2011 19:04:36 +0100
changeset 7492 5299fc683dfa
parent 7491 dea6f61d3247
child 7493 3bbefa91e694
Clean some dead waf code
src/wscript
wscript
--- a/src/wscript	Mon Sep 12 18:57:10 2011 +0100
+++ b/src/wscript	Mon Sep 12 19:04:36 2011 +0100
@@ -13,10 +13,6 @@
 import Options
 import Build
 import Utils
-#import Constants
-
-#import ccroot
-#ccroot.USE_TOP_LEVEL = True
 
 import wutils
 
@@ -105,87 +101,12 @@
     conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules]
 
 
-# class ns3module_taskgen(TaskGen.task_gen):
-#     def __init__(self, *args, **kwargs):
-#         super(ns3module_taskgen, self).__init__(*args, **kwargs)
-#         self.libs = []
 
-#     def apply(self):
-#         print "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-#         static_enabled = False
-#         shared_enabled = True
-#         bld = self.bld
-#         if bld.env['ENABLE_STATIC_NS3']:
-#             static_enabled = True
-#             shared_enabled = False
-#         if bld.env['ENABLE_SHARED_AND_STATIC_NS3']:
-#             static_enabled = True
-#             shared_enabled = True
-
-#         assert self.name.startswith("ns3-")
-#         name = self.name.split("ns3-")[1]
-
-#         if static_enabled:
-#             static = self._create_ns3_module(self.bld, name, self.dependencies, True)
-#             self.libs.append(static)
-#         else:
-#             static = None
-
-#         if shared_enabled:
-#             shared = self._create_ns3_module(self.bld, name, self.dependencies, False)
-#             self.libs.append(shared)
-#         else:
-#             shared = None
-
-#         if static is not None and shared is None:
-#             static.name = self.name + "--lib"
-#             static.uselib_local = ['ns3-%s--lib' % (dep,) for dep in self.dependencies]
-
-#         elif shared is not None and static is None:
-#             shared.name = self.name + "--lib"
-#             shared.uselib_local = ['ns3-%s--lib' % (dep,) for dep in self.dependencies]
-#         else:
-#             shared.name = self.name + "--lib"
-#             shared.uselib_local = ['ns3-%s--lib' % (dep,) for dep in self.dependencies]
-#             static.name = self.name + "--static"
-#             static.uselib_local = ['ns3-%s--static' % (dep,) for dep in self.dependencies]
-
-#         if not self.test:
-#             pcfile = bld.new_task_gen('ns3pcfile')
-#             pcfile.module = self
-
-#     def _create_ns3_module(self, bld, name, dependencies, static):
-
-#         # FIXME: env modifications are overwritten by parent caller
-
-
+# we need the 'ns3module' waf "feature" to be created because code
+# elsewhere looks for it to find the ns3 module objects.
 @TaskGen.feature('ns3module')
-@TaskGen.after_method('process_rule')
 def _add_test_code(module):
-    bld = module.bld
-    if 0: #len(module.source) > 0 and hasattr(module, 'ns3_dir_location'):
-        uselib_cpppath = []
-        for lib in module.uselib.split():
-            if 'CPPPATH_%s' % lib in module.env:
-                uselib_cpppath.extend(module.env['CPPPATH_%s' % lib])
-        objects = []
-        for src in module.source[0:-1]:
-            full_src = os.path.join(module.ns3_dir_location, src)
-            path = os.path.dirname(full_src)
-            target = '%s_object' % src
-            # XXX: calculate the features correctly here.
-            obj = bld.objects(source=[full_src], target=target, features='cxx cc',
-                              env = module.env.copy())
-            obj.env.CXXDEFINES += 'NS_TEST_SOURCEDIR="%s"' % path
-            obj.env.INCLUDES += uselib_cpppath
-            obj.name = module.name + '--test'
-            objects.append(target)
-        last = module.source[-1]
-        full_src = os.path.join(module.ns3_dir_location, last)
-        path = os.path.dirname(full_src)
-        module.env.CXXDEFINES += 'NS_TEST_SOURCEDIR="%s"' % path
-        module.source = [last] + objects
-        #module.add_objects.extend(objects)
+    pass
 
 
 def create_ns3_module(bld, name, dependencies=(), test=False):
@@ -522,31 +443,13 @@
         task.module = self.module
 
 
-# @TaskGen.extension('.h')
-# class ns3header_taskgen(TaskGen.task_gen):
-#     """A set of NS-3 header files"""
-#     COLOR = 'BLUE'
-#     def __init__(self, *args, **kwargs):
-#         super(ns3header_taskgen, self).__init__(*args, **kwargs)
-#         self.install_path = None
-#         self.sub_dir = None # if not None, header files will be published as ns3/sub_dir/file.h
-#         self.module = None # module name
-#         self.mode = 'install'
-#         self.features.append(features=['ns3header'])
-#         print "YYYYYYYYYYYYYYYYYYYYYYYYYYY", self
-
 
 @TaskGen.feature('ns3header')
 @TaskGen.after_method('process_rule')
 def apply_ns3header(self):
-    #for filename in set(self.to_list(self.source)):
-    #    src_node = self.path.find_resource(filename)
     if self.module is None:
         raise Utils.WafError("'module' missing on ns3headers object %s" % self)
     ns3_dir_node = self.bld.path.find_dir("ns3")
-    #if self.sub_dir is not None:
-    #    ns3_dir_node = ns3_dir_node.find_dir(self.sub_dir)
-
     for filename in set(self.to_list(self.source)):
         src_node = self.path.find_resource(filename)
         if src_node is None:
@@ -564,6 +467,7 @@
     self.headers = set(self.to_list(self.source))
     self.source = '' # tell WAF not to process these files further
 
+
 class ns3header_task(Task.Task):
     before = 'cc cxx gen_ns3_module_header'
     color = 'BLUE'
--- a/wscript	Mon Sep 12 18:57:10 2011 +0100
+++ b/wscript	Mon Sep 12 19:04:36 2011 +0100
@@ -16,13 +16,8 @@
 
 import Logs
 import TaskGen
-#import Constants
-
-#import ccroot
-#ccroot.USE_TOP_LEVEL = True
 
 import Task
-#Task.algotype = Constants.JOBCONTROL # so that Task.maxjobs=1 takes effect
 
 import Utils
 import Build
@@ -280,15 +275,6 @@
     conf.check_tool('command', ['waf-tools'])
     conf.check_tool('gnu_dirs')
 
-    #if os.path.exists('/usr/lib64'):
-    #    conf.env.LIBDIR = os.path.join(conf.env.PREFIX, "lib64")
-
-
-    # variant_name = Options.options.build_profile
-    # if Options.options.enable_gcov:
-    #     variant_name += '-gcov'
-    # conf.env['NS3_ACTIVE_VARIANT'] = variant_name
-    # conf.setenv(variant_name, env=conf.env.derive()) # start with a copy instead of a new env
     env = conf.env
 
     if Options.options.enable_gcov:
@@ -1055,116 +1041,3 @@
     finally:
         os.chdir("..")
 
-##
-## The default WAF DistDir implementation is rather slow, because it
-## first copies everything and only later removes unwanted files and
-## directories; this means that it needless copies the full build dir
-## and the .hg repository tree.  Here we provide a replacement DistDir
-## implementation that is more efficient.
-##
-# import Scripting
-# from Scripting import dist_exts, excludes, BLDDIR
-# import Utils
-# import os
-
-# def _copytree(src, dst, symlinks=False, excludes=(), build_dir=None):
-#     """Recursively copy a directory tree using copy2().
-
-#     The destination directory must not already exist.
-#     If exception(s) occur, an Error is raised with a list of reasons.
-
-#     If the optional symlinks flag is true, symbolic links in the
-#     source tree result in symbolic links in the destination tree; if
-#     it is false, the contents of the files pointed to by symbolic
-#     links are copied.
-
-#     XXX Consider this example code rather than the ultimate tool.
-
-#     Note: this is a modified version of shutil.copytree from python
-#     2.5.2 library; modified for WAF purposes to exclude dot dirs and
-#     another list of files.
-#     """
-#     names = os.listdir(src)
-#     os.makedirs(dst)
-#     errors = []
-#     for name in names:
-#         srcname = os.path.join(src, name)
-#         dstname = os.path.join(dst, name)
-#         try:
-#             if symlinks and os.path.islink(srcname):
-#                 linkto = os.readlink(srcname)
-#                 os.symlink(linkto, dstname)
-#             elif os.path.isdir(srcname):
-#                 if name in excludes:
-#                     continue
-#                 elif name.startswith('.') or name.startswith(',,') or name.startswith('++') or name.startswith('CVS'):
-#                     continue
-#                 elif name == build_dir:
-#                     continue
-#                 else:
-#                     ## build_dir is not passed into the recursive
-#                     ## copytree, but that is intentional; it is a
-#                     ## directory name valid only at the top level.
-#                     copytree(srcname, dstname, symlinks, excludes)
-#             else:
-#                 ends = name.endswith
-#                 to_remove = False
-#                 if name.startswith('.') or name.startswith('++'):
-#                     to_remove = True
-#                 else:
-#                     for x in dist_exts:
-#                         if ends(x):
-#                             to_remove = True
-#                             break
-#                 if not to_remove:
-#                     shutil.copy2(srcname, dstname)
-#             # XXX What about devices, sockets etc.?
-#         except (IOError, os.error), why:
-#             errors.append((srcname, dstname, str(why)))
-#         # catch the Error from the recursive copytree so that we can
-#         # continue with other files
-#         except shutil.Error, err:
-#             errors.extend(err.args[0])
-#     try:
-#         shutil.copystat(src, dst)
-#     except WindowsError:
-#         # can't copy file access times on Windows
-#         pass
-#     except OSError, why:
-#         errors.extend((src, dst, str(why)))
-#     if errors:
-#         raise shutil.Error, errors
-
-
-# def DistDir(appname, version):
-#     #"make a distribution directory with all the sources in it"
-#     import shutil
-
-#     # Our temporary folder where to put our files
-#     TMPFOLDER=appname+'-'+version
-
-#     # Remove an old package directory
-#     if os.path.exists(TMPFOLDER): shutil.rmtree(TMPFOLDER)
-
-#     global g_dist_exts, g_excludes
-
-#     # Remove the Build dir
-#     build_dir = getattr(Utils.g_module, BLDDIR, None)
-
-#     # Copy everything into the new folder
-#     _copytree('.', TMPFOLDER, excludes=excludes, build_dir=build_dir)
-
-#     # TODO undocumented hook
-#     dist_hook = getattr(Utils.g_module, 'dist_hook', None)
-#     if dist_hook:
-#         os.chdir(TMPFOLDER)
-#         try:
-#             dist_hook()
-#         finally:
-#             # go back to the root directory
-#             os.chdir('..')
-#     return TMPFOLDER
-
-# Scripting.DistDir = DistDir
-
-