Merge lp:~knitzsche/dotdepends/bug-1023095 into lp:dotdepends

Proposed by Kyle Nitzsche
Status: Merged
Merged at revision: 70
Proposed branch: lp:~knitzsche/dotdepends/bug-1023095
Merge into: lp:dotdepends
Diff against target: 316 lines (+48/-66)
5 files modified
Dotdepends/Dot.py (+17/-10)
debian/changelog (+10/-0)
debian/rules (+0/-1)
usr/bin/dotdepends (+6/-12)
usr/bin/dotdepends-merge (+15/-43)
To merge this branch: bzr merge lp:~knitzsche/dotdepends/bug-1023095
Reviewer Review Type Date Requested Status
Mike Carifio Approve
Review via email: mp+114254@code.launchpad.net
To post a comment you must log in.
lp:~knitzsche/dotdepends/bug-1023095 updated
70. By Kyle Nitzsche

* dotdepends-merge: fixed some blurry logic on setting node borders red
* rest is mostly code cleanup

Revision history for this message
Mike Carifio (carifio) wrote :

line 54: exiist -> exist

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Dotdepends/Dot.py'
2--- Dotdepends/Dot.py 2012-07-04 00:40:59 +0000
3+++ Dotdepends/Dot.py 2012-07-10 22:00:25 +0000
4@@ -92,7 +92,7 @@
5 def get_content(self):
6 """Returns the content of the dot file as a list of lines.
7
8- Content is the dot file with out the header or footer.
9+ Content is the dot file without the header or footer.
10 """
11 content = []
12 for line in self.dot:
13@@ -106,7 +106,7 @@
14 def get_joins(self):
15 """Returns the 'join' lines from the dot file as a list of lists [[]].
16
17- Join lines are edgesi between nodes, specifically: lnode -> rnode.
18+ Join lines are edges between nodes, specifically: lnode -> rnode.
19 There may be a style after the rnode: lnode -> rnode style. Each
20 top-level list represents a join line. This contains a list containing
21 the items in the line as follows: [lnode, rnode, style(if any)]
22@@ -130,8 +130,9 @@
23 def get_nodes(self):
24 """Returns a dictionary of nodes in the dot file where the key is the
25 node name and the value is the style, if any, as a string, without the
26- closing square brackets.
27+ enclosing square brackets one finds in a dot file.
28 """
29+
30 nodes = dict()
31 node_lines = []
32 for line in self.content:
33@@ -151,6 +152,7 @@
34 where the key is lnode name and the value is the number of times the
35 lnode exists as an lnode in the dot file.
36 """
37+
38 lnodes = dict()
39 for join in self.joins:
40 if len(join) == 0: continue
41@@ -166,6 +168,7 @@
42 where the key is rnode name and the value is the number of times the
43 rnode exists as an rnode in the dot file.
44 """
45+
46 rnodes = dict()
47 for join in self.joins:
48 if len(join) == 0: continue
49@@ -177,7 +180,7 @@
50 return rnodes
51
52 def get_popular_lnodes(self, popularity):
53- """Returns a dictionary of lnodes where all lnodes exit as lnodes in
54+ """Returns a dictionary of lnodes where all lnodes exiist as lnodes in
55 the dot at least as many times as specified by the 'popularity' arg.
56 """
57 popular = dict()
58@@ -215,7 +218,8 @@
59 family in order to make large graphs smaller and easier to comprehend.
60
61 A family of nodes is a set of nodes that have no lnodes outside of the
62- family (except for the root node of the family which does have lnodes).
63+ family (except for the root node of the family which does have lnodes
64+ outside of the family).
65 """
66
67 rnodes = self.get_rnodes_for_lnode(node)
68@@ -323,8 +327,9 @@
69 where the key is node and the value is an approriately amended style.
70
71 Nodes internal to families that are not the family top node are
72- dropped as part of family summariation.
73+ dropped as part of family summarization.
74 """
75+
76 n_nodes = dict()
77 for node in self.nodes.keys():
78 if node in f_internal_nodes:
79@@ -338,11 +343,13 @@
80 if not _s.startswith("label="):
81 n_styles+= _s + ','
82 if style.find('fillcolor=blue') >-1:#this is the root node
83- style = n_styles + \
84-"fillcolor=blue,style=filled,shape=%s" % self.shape
85+ style = n_styles
86+ style += "fillcolor=blue,style=filled,shape="
87+ style += self.shape
88 else:
89- style = n_styles + \
90-"fillcolor=yellow,style=filled,shape=%s" % self.shape
91+ style = n_styles
92+ style += "fillcolor=yellow,style=filled,shape="
93+ style += self.shape
94 node = "%s_Family_%d" % (node, len(fams[fam]))
95 if node != fam and node in fams[fam]:
96 continue
97
98=== modified file 'debian/changelog'
99--- debian/changelog 2012-07-09 18:43:48 +0000
100+++ debian/changelog 2012-07-10 22:00:25 +0000
101@@ -1,3 +1,13 @@
102+dotdepends (0.3.15kyle1) UNRELEASED; urgency=low
103+
104+ * redundant 'color="red"' styles in nodes in generated pkg-DETAIL.dot files
105+ caused dotdepends-merge on such dot files to incorrected draw some node
106+ borders, colorwise. fixes LP: #1023095
107+ * dotdepends-merge: fixed some blurry logic on setting node borders red
108+ * rest is mostly code cleanup
109+
110+ -- Kyle Nitzsche <kyle.nitzsche@canonical.com> Tue, 10 Jul 2012 17:53:20 -0400
111+
112 dotdepends (0.3.15) precise; urgency=low
113
114 * fix recent failures of -d option on dotdepends (disables auto running of
115
116=== modified file 'debian/rules'
117--- debian/rules 2012-06-21 21:33:13 +0000
118+++ debian/rules 2012-07-10 22:00:25 +0000
119@@ -6,7 +6,6 @@
120 override_dh_auto_install:
121 python ./setup.py install --root=$(CURDIR)/debian/tmp --prefix=/usr --install-layout=deb
122
123-
124 override_dh_auto_clean:
125 -find . -name '*.py[co]' | xargs rm -f
126
127
128=== modified file 'usr/bin/dotdepends'
129--- usr/bin/dotdepends 2012-07-09 18:14:03 +0000
130+++ usr/bin/dotdepends 2012-07-10 22:00:25 +0000
131@@ -239,8 +239,6 @@
132 ]
133 if opt.dont_run_dot:
134 cmd.append('-d')
135- if opt.installed:
136- cmd.append('-i')
137
138 # output_dir_created is True iff the subprocess below will create (and populate)
139 # a new directory opt.output_dir.
140@@ -268,17 +266,14 @@
141 if opt.dont_run_dot:
142 cmd.append('-d')
143
144- if opt.installed and opt.mode == 'rdepends':
145- cmd.append('-i')
146-
147 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
148 f2 = p.communicate()
149 # Did the process error?
150 if p.returncode > 0 or (f2[1] is not None and f2[1].startswith('Error')):
151 # Yes, pass the error along
152 print >> sys.stderr, f2[1]
153- exit(1)
154-
155+ sys.exit(1)
156+
157 f2dot = f2[0].rstrip('.png\n')
158 if not f2dot.endswith(".dot"):
159 f2dot += ".dot"
160@@ -299,7 +294,7 @@
161
162 _f3 = []
163 for line in f3:
164- if line.find("->") > -1:
165+ if line.find("->") > -1:
166 _f3.append(line)
167 continue
168 if line.find("{") > -1:
169@@ -312,7 +307,8 @@
170 _line = line.lstrip()
171 _pkg = _line.split(" ")[0]
172 if _pkg in adds:
173- line = line.replace("[", '[color="red",')
174+ if line.find('color="red"') == -1:
175+ line = line.replace("[", '[color="red",')
176 _f3.append(line)
177
178 _f = open(f3dot, 'w')
179@@ -321,7 +317,6 @@
180 _f.flush()
181 _f.close()
182
183-
184 if opt.dont_run_dot:
185 print f3dot
186 else:
187@@ -349,7 +344,6 @@
188
189 sys.exit(0)
190
191-
192 deps = dict([])
193 recommends = dict([])
194 onlyRecs = []
195@@ -393,7 +387,7 @@
196 p1 = replacement(k)
197 if p1 == "label": continue
198 p2 = replacement(v)
199- # made joins ('edges')
200+ # make joins ('edges')
201 if opt.mode == "rdepends":
202 edge = '%s -> %s\n' % (p2,p1)
203 elif opt.mode == "depends":
204
205=== modified file 'usr/bin/dotdepends-merge'
206--- usr/bin/dotdepends-merge 2012-07-09 14:42:21 +0000
207+++ usr/bin/dotdepends-merge 2012-07-10 22:00:25 +0000
208@@ -79,33 +79,19 @@
209 _n1 = addShapes(n1,s1,c1)
210 _n2 = addShapes(n2,s2,c2)
211
212-_shape='shape="diamond",fillcolor=orange,style=filled'
213+_shape='shape="diamond",fillcolor="orange",style="filled"'
214 _nFinal = dict()
215
216-#print _n1.keys()
217-#print _n2.keys()
218-
219 nBoth = set(_n1.keys()).intersection(set(_n2.keys()))
220 n1Only = set(_n1.keys()).difference(set(_n2.keys()))
221 n2Only = set(_n2.keys()).difference(set(_n1.keys()))
222
223-#print "1"
224-#for n in n1Only:
225-# print "%s" % (n)
226-#print "2"
227-#for n in n2Only:
228-# print "%s" % (n)
229-#print "BOTH"
230-#for n in nBoth:
231-# print "%s" % (n)
232-#sys.exit()
233-
234 nWorking = dict()
235 nFinal = dict()
236
237 for node in nBoth:
238 n = _n1[node]
239- # if color="red" in both node sets, this pkg is only a Rec
240+ # if color:red is in both node sets, this pkg is only a Rec
241 # and needs to be red here too.
242 aRec = False
243 try:
244@@ -115,11 +101,14 @@
245 except:
246 pass
247 try:
248- if 'color' in _n[node].keys():
249- if _n1[node][color] == 'red':
250+ if 'color' in _n2[node].keys():
251+ if _n2[node][color] == 'red':
252 aRec = True
253+ else:
254+ aRec = False
255 except:
256- pass
257+ aRec = False
258+
259 if aRec:
260 n['color'] = 'red'
261
262@@ -134,17 +123,9 @@
263 try:
264 if 'color' in _n1[node].keys():
265 if _n1[node][color] == 'red':
266- aRec = True
267- except:
268- pass
269- try:
270- if 'color' in _n[node].keys():
271- if _n1[node][color] == 'red':
272- aRec = True
273- except:
274- pass
275- if aRec:
276- n['color'] = 'red'
277+ n['color'] = 'red'
278+ except:
279+ pass
280 n['shape'] = s1
281 n['fillcolor'] = c1
282 n['style'] = 'filled'
283@@ -152,21 +133,12 @@
284
285 for node in n2Only:
286 n = _n2[node]
287- aRec = False
288 try:
289 if 'color' in _n1[node].keys():
290 if _n1[node][color] == 'red':
291- aRec = True
292- except:
293- pass
294- try:
295- if 'color' in _n[node].keys():
296- if _n1[node][color] == 'red':
297- aRec = True
298- except:
299- pass
300- if aRec:
301- n['color'] = 'red'
302+ n['color'] = 'red'
303+ except:
304+ pass
305 n['shape'] = s2
306 n['fillcolor'] = c2
307 n['style'] = 'filled'
308@@ -196,7 +168,7 @@
309 line = "%s [" % n
310 for style in nFinal[n]:
311 if style == '': continue
312- line += '%s="%s",' %(style,nFinal[n][style])
313+ line += '%s="%s",' % (style, nFinal[n][style])
314 line = line[:len(line)-1]
315 line += '];'
316 print line

Subscribers

People subscribed via source and target branches

to all changes: