at master 3.5 kB view raw
1diff --git a/dot2tex/dotparsing.py b/dot2tex/dotparsing.py 2index 391b5dc..6dc77a3 100644 3--- a/dot2tex/dotparsing.py 4+++ b/dot2tex/dotparsing.py 5@@ -180,18 +180,8 @@ def __find_executables(path): 6 def find_graphviz(): 7 """Locate Graphviz's executables in the system. 8 9- Tries three methods: 10- 11- First: Windows Registry (Windows only) 12- This requires Mark Hammond's pywin32 is installed. 13- 14- Secondly: Search the path 15- It will look for 'dot', 'twopi' and 'neato' in all the directories 16- specified in the PATH environment variable. 17- 18- Thirdly: Default install location (Windows only) 19- It will look for 'dot', 'twopi' and 'neato' in the default install 20- location under the "Program Files" directory. 21+ It will look for 'dot', 'twopi' and 'neato' in 22+ @graphviz@/bin. 23 24 It will return a dictionary containing the program names as keys 25 and their paths as values. 26@@ -199,75 +189,9 @@ def find_graphviz(): 27 If this fails, it returns None. 28 """ 29 30- # Method 1 (Windows only) 31- # 32- if os.sys.platform == 'win32': 33- try: 34- import win32api, win32con 35- 36- # Get the GraphViz install path from the registry 37- # 38- hkey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, 39- "SOFTWARE\AT&T Research Labs\Graphviz", 0, win32con.KEY_QUERY_VALUE) 40- 41- path = win32api.RegQueryValueEx(hkey, "InstallPath")[0] 42- win32api.RegCloseKey(hkey) 43- 44- # Now append the "bin" subdirectory: 45- # 46- path = os.path.join(path, "bin") 47- progs = __find_executables(path) 48- if progs is not None: 49- # print("Used Windows registry") 50- return progs 51- 52- except ImportError: 53- # Print a messaged suggesting they install these? 54- # 55- log.debug('The win32api is not installed') 56- pass 57- except: 58- log.debug('Failed to access the registry key') 59- 60- # Method 2 (Linux, Windows etc) 61- # 62- if 'PATH' in os.environ: 63- for path in os.environ['PATH'].split(os.pathsep): 64- progs = __find_executables(path) 65- if progs is not None: 66- return progs 67- 68- # Method 3 (Windows only) 69- # 70- if os.sys.platform == 'win32': 71- # Try and work out the equivalent of "C:\Program Files" on this 72- # machine (might be on drive D:, or in a different language) 73- # 74- if 'PROGRAMFILES' in os.environ: 75- # Note, we could also use the win32api to get this 76- # information, but win32api may not be installed. 77- 78- path = os.path.join(os.environ['PROGRAMFILES'], 'ATT', 'GraphViz', 'bin') 79- 80- else: 81- # Just in case, try the default... 82- path = r"C:\Program Files\att\Graphviz\bin" 83- 84- progs = __find_executables(path) 85- 86- if progs is not None: 87- # print("Used default install location") 88- return progs 89- 90- for path in ( 91- '/usr/bin', '/usr/local/bin', 92- '/opt/local/bin', 93- '/opt/bin', '/sw/bin', '/usr/share', 94- '/Applications/Graphviz.app/Contents/MacOS/'): 95- progs = __find_executables(path) 96- if progs is not None: 97- # print("Used path") 98- return progs 99+ progs = __find_executables('@graphviz@/bin') 100+ if progs is not None: 101+ return progs 102 103 # Failed to find GraphViz 104 #