From aa060ff48c29667c5bd710b1023eb79ac86741ac Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Thu, 20 Aug 2009 15:43:23 +0000
Subject: [PATCH] Simplify ALlIncludesHH usage Fix python imports in
 SConscripts

---
 PPI/SConscript                   | 4 +---
 SConstruct                       | 4 ++--
 Socket/Protocols/DVB/SConscript  | 3 +--
 Socket/Protocols/INet/SConscript | 3 +--
 Socket/Protocols/Raw/SConscript  | 3 +--
 Socket/Protocols/UN/SConscript   | 3 +--
 Socket/SConscript                | 3 +--
 Utils/Logger/SConscript          | 4 +---
 Utils/Termlib/SConscript         | 2 +-
 debian/SConscript                | 2 +-
 senfscons/SENFSCons.py           | 5 ++++-
 11 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/PPI/SConscript b/PPI/SConscript
index 50962cd6a..d74fc6035 100644
--- a/PPI/SConscript
+++ b/PPI/SConscript
@@ -7,9 +7,7 @@ import SENFSCons, glob
 
 SConscript(glob.glob("*/SConscript"))
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if f not in ('all_includes.hh','PPI.hh') \
-                                  and not f.endswith('.test.hh') ])
+SENFSCons.AllIncludesHH(env, exclude = ['PPI.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env, subdirs=[ 'detail' ])
 
diff --git a/SConstruct b/SConstruct
index 7cf036273..a972bf40e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,6 +1,6 @@
 # -*- python -*-
 
-import sys, glob, os.path, datetime, pwd, time, fnmatch, string
+import sys, glob, os.path, fnmatch
 sys.path.append(Dir('#/senfscons').abspath)
 sys.path.append(Dir('#/doclib').abspath)
 import SENFSCons, senfutil
@@ -172,7 +172,7 @@ env.PhonyTarget('valgrind', [ 'all_tests' ], [ """
 #### clean
 env.Clean('all', '.prepare-stamp')
 env.Clean('all', libsenf)
-env.Clean('all', 'linklint')
+env.Clean('all', env.Dir('linklint')) # env.Dir to disambiguate from linklint PhonyTarget
 
 if env.GetOption('clean'):
     env.Clean('all', [ os.path.join(path,f)
diff --git a/Socket/Protocols/DVB/SConscript b/Socket/Protocols/DVB/SConscript
index e1c3df49e..abbb59111 100644
--- a/Socket/Protocols/DVB/SConscript
+++ b/Socket/Protocols/DVB/SConscript
@@ -7,8 +7,7 @@ import SENFSCons, glob
 
 SConscript(glob.glob("*/SConscript"))
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if f not in ('all_includes.hh','DVB.hh') and not f.endswith('.test.hh') ])
+SENFSCons.AllIncludesHH(env, exclude=['DVB.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env)
 
diff --git a/Socket/Protocols/INet/SConscript b/Socket/Protocols/INet/SConscript
index 9de80d5c5..4ef213329 100644
--- a/Socket/Protocols/INet/SConscript
+++ b/Socket/Protocols/INet/SConscript
@@ -7,8 +7,7 @@ import SENFSCons, glob
 
 SConscript(glob.glob("*/SConscript"))
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if f not in ('all_includes.hh','INet.hh') and not f.endswith('.test.hh') ])
+SENFSCons.AllIncludesHH(env, exclude=['INet.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env)
 
diff --git a/Socket/Protocols/Raw/SConscript b/Socket/Protocols/Raw/SConscript
index 5f6b22318..a75c7546a 100644
--- a/Socket/Protocols/Raw/SConscript
+++ b/Socket/Protocols/Raw/SConscript
@@ -7,8 +7,7 @@ import SENFSCons, glob
 
 SConscript(glob.glob("*/SConscript"))
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if f not in ('all_includes.hh','Raw.hh') and not f.endswith('.test.hh') ])
+SENFSCons.AllIncludesHH(env, exclude=['Raw.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env)
 
diff --git a/Socket/Protocols/UN/SConscript b/Socket/Protocols/UN/SConscript
index 6366cfd1b..33e12acf9 100644
--- a/Socket/Protocols/UN/SConscript
+++ b/Socket/Protocols/UN/SConscript
@@ -7,8 +7,7 @@ import SENFSCons, glob
 
 SConscript(glob.glob("*/SConscript"))
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if f not in ('all_includes.hh','UN.hh') and not f.endswith('.test.hh') ])
+SENFSCons.AllIncludesHH(env, exclude=['UN.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env)
 
diff --git a/Socket/SConscript b/Socket/SConscript
index aac2ec5e5..2e9bd62a5 100644
--- a/Socket/SConscript
+++ b/Socket/SConscript
@@ -7,8 +7,7 @@ import SENFSCons, glob
 
 SConscript(glob.glob("*/SConscript"))
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if f not in ('all_includes.hh','Socket.hh') and not f.endswith('.test.hh') ])
+SENFSCons.AllIncludesHH(env, exclude=['Socket.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env)
 
diff --git a/Utils/Logger/SConscript b/Utils/Logger/SConscript
index af32a0165..dd2bd2395 100644
--- a/Utils/Logger/SConscript
+++ b/Utils/Logger/SConscript
@@ -5,9 +5,7 @@ import SENFSCons, glob
 
 ###########################################################################
 
-SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
-                               if ( f not in ('all_includes.hh','Logger.hh','SenfLog.hh')
-                                    and not f.endswith('.test.hh') ) ])
+SENFSCons.AllIncludesHH(env, exclude=['Logger.hh','SenfLog.hh'])
 
 sources, tests, includes = SENFSCons.Glob(env)
 
diff --git a/Utils/Termlib/SConscript b/Utils/Termlib/SConscript
index 9ec49886a..9d1978ac7 100644
--- a/Utils/Termlib/SConscript
+++ b/Utils/Termlib/SConscript
@@ -11,4 +11,4 @@ env.Append(ALLOBJECTS = env.Object(sources))
 env.BoostUnitTest('test', tests)
 SENFSCons.Doxygen(env)
 env.InstallSubdir('$INCLUDEINSTALLDIR', includes)
-env.Program('telnetSserver', ['telnetServer.cc'])
+env.Program('telnetServer', ['telnetServer.cc'])
diff --git a/debian/SConscript b/debian/SConscript
index 548c560ae..1233a2e6e 100644
--- a/debian/SConscript
+++ b/debian/SConscript
@@ -1,7 +1,7 @@
 # -*- python -*-
 
 Import('env')
-import SENFSCons, os
+import SENFSCons, os, os.path, pwd, time, string
 
 ###########################################################################
 
diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py
index bdb44f001..ba49af593 100644
--- a/senfscons/SENFSCons.py
+++ b/senfscons/SENFSCons.py
@@ -79,7 +79,10 @@ def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []):
 
     return doc
 
-def AllIncludesHH(env, headers):
+def AllIncludesHH(env, exclude=[]):
+    exclude = exclude[:] + ['all_includes.hh'] # Make a copy !!
+    headers = [ f for f in glob.glob("*.hh")
+                if f not in exclude and not f.endswith('.test.hh') ]
     headers.sort()
     target = env.File("all_includes.hh")
     file(target.abspath,"w").write("".join([ '#include "%s"\n' % f
-- 
GitLab