dia r4338 - trunk/plug-ins/python
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4338 - trunk/plug-ins/python
- Date: Tue, 24 Mar 2009 19:38:37 +0000 (UTC)
Author: hans
Date: Tue Mar 24 19:38:37 2009
New Revision: 4338
URL: http://svn.gnome.org/viewvc/dia?rev=4338&view=rev
Log:
wdeps.py : 2007-07-09 - added --remove-symbols= to allow to cut modules by specific symbols
Modified:
trunk/plug-ins/python/wdeps.py
Modified: trunk/plug-ins/python/wdeps.py
==============================================================================
--- trunk/plug-ins/python/wdeps.py (original)
+++ trunk/plug-ins/python/wdeps.py Tue Mar 24 19:38:37 2009
@@ -151,6 +151,28 @@
for k2 in node.deps.keys () :
if rr.match (k2) :
del node.deps[k2]
+def RemoveBySymbols (deps, list) :
+ "If a connection is conly caused by some symbol in 'list' it is removed"
+ for k in deps.keys() :
+ node = deps[k]
+ for c in node.deps.keys () :
+ edge = node.deps[c]
+ kills = []
+ for s2 in edge.symbols :
+ for s1 in list :
+ # only comparing the start of the symbol
+ if string.find (s2, s1) == 0 :
+ #print "removing", s2, "from", c, "->", k
+ kills.append (s2)
+ #NOT modifying while iterating: edge.symbols.remove (s2)
+ break
+ if len(edge.symbols) == len(kills) :
+ # remove complete edge (maybe we should only mark it removed?)
+ #print "removing", c, "from", k
+ del node.deps[c]
+ else :
+ for s in kills :
+ edge.symbols.remove (s)
def Reduce (deps, f, bHintOnly = 1) :
"Automatically remove connections until there is only something reasonable left"
# first iteration: two components are connected in both directions
@@ -277,6 +299,7 @@
deps = {}
dllsToRemove = []
regexRemoves = []
+ symbolsToRemove = []
nMaxDepth = 10000 # almost unlimited
bHaveComponents = 0
bDump = 0
@@ -295,10 +318,12 @@
elif arg == "--remove-gtk" : dllsToRemove.extend (dllsGtk)
elif string.find (arg, "--remove-regex=") == 0 :
regexRemoves.append (arg[len("--remove-regex="):])
+ elif string.find (arg, "--remove-symbols=") == 0 :
+ noSyms = string.split(arg[len("--remove-symbols="):], ",")
+ symbolsToRemove.extend (noSyms)
else :
noDeps = string.split(arg[len("--remove="):], ",")
- for s in noDeps :
- dllsToRemove.append(s)
+ dllsToRemove.extend(noDeps)
elif string.find (arg, "--dont-follow") == 0 :
global g_DontFollow
noFollow = string.split(arg[len("--dont-follow="):], ",")
@@ -386,8 +411,11 @@
for s in components:
GetDeps (s, deps, nMaxDepth)
- Remove (deps, dllsToRemove)
-
+ if len(dllsToRemove) :
+ Remove (deps, dllsToRemove)
+ if len(symbolsToRemove) > 0 :
+ RemoveBySymbols (deps, symbolsToRemove)
+
for rr in regexRemoves :
RemoveRegEx (deps, rr)
@@ -401,7 +429,6 @@
f.write ("CutLeafs " + str(nTotal) + " => " + str(nTotal - len(leafs)) + "\n")
leafs.sort()
f.write ("\t" + string.join (leafs, ",") + "\n")
- f.flush()
nCutLeafs -= 1
else :
leafs = CutLeafs (deps, nCutLeafs)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]