summary refs log tree commit diff
path: root/pkgs/development/python-modules/objgraph/hardcode-graphviz-path.patch
blob: c5be5de64eed50e0ac8c4a152d2d75257650b8b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff --git a/objgraph.py b/objgraph.py
index 88e307b..0369f49 100755
--- a/objgraph.py
+++ b/objgraph.py
@@ -1045,12 +1045,12 @@ def _present_graph(dot_filename, filename=None):
     if not filename and _program_in_path('xdot'):
         print("Spawning graph viewer (xdot)")
         subprocess.Popen(['xdot', dot_filename], close_fds=True)
-    elif _program_in_path('dot'):
+    elif True: # path to dot is hardcoded and hence always in $PATH
         if not filename:
             print("Graph viewer (xdot) not found, generating a png instead")
             filename = dot_filename[:-4] + '.png'
         stem, ext = os.path.splitext(filename)
-        cmd = ['dot', '-T' + ext[1:], '-o' + filename, dot_filename]
+        cmd = ['@graphviz@/bin/dot', '-T' + ext[1:], '-o' + filename, dot_filename]
         dot = subprocess.Popen(cmd, close_fds=False)
         dot.wait()
         if dot.returncode != 0:
diff --git a/tests.py b/tests.py
index 7db2888..bdb666e 100755
--- a/tests.py
+++ b/tests.py
@@ -557,7 +557,7 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
         self.programsInPath(['dot'])
         objgraph._present_graph('foo.dot', 'bar.png')
         self.assertOutput("""
-            subprocess.Popen(['dot', '-Tpng', '-obar.png', 'foo.dot'])
+            subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-obar.png', 'foo.dot'])
             Image generated as bar.png
         """)
 
@@ -566,11 +566,12 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
         objgraph.subprocess.should_fail = True
         objgraph._present_graph('f.dot', 'b.png')
         self.assertOutput("""
-            subprocess.Popen(['dot', '-Tpng', '-ob.png', 'f.dot'])
-            dot failed (exit code 1) while executing "dot -Tpng -ob.png f.dot"
+            subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-ob.png', 'f.dot'])
+            dot failed (exit code 1) while executing "@graphviz@/bin/dot -Tpng -ob.png f.dot"
         """)
 
-    def test_present_png_no_dot(self):
+    @unittest.skip("empty $PATH has no effect")
+    def no_test_present_png_no_dot(self):
         self.programsInPath([])
         objgraph._present_graph('foo.dot', 'bar.png')
         self.assertOutput("""
@@ -591,10 +592,11 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
         objgraph._present_graph('foo.dot')
         self.assertOutput("""
             Graph viewer (xdot) not found, generating a png instead
-            subprocess.Popen(['dot', '-Tpng', '-ofoo.png', 'foo.dot'])
+            subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-ofoo.png', 'foo.dot'])
             Image generated as foo.png
         """)
 
+    @unittest.skip("empty $PATH has no effect")
     def test_present_no_xdot_and_no_not(self):
         self.programsInPath([])
         objgraph._present_graph('foo.dot')