/[ascend]/trunk/scons/graphviz.py
ViewVC logotype

Annotation of /trunk/scons/graphviz.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1853 - (hide annotations) (download) (as text)
Thu Sep 11 06:13:47 2008 UTC (15 years, 2 months ago) by jpye
File MIME type: text/x-python
File size: 1621 byte(s)
Fixed detection of Graphviz on linux where pkg-config is available (should be always).
This will break detection of Graphviz on Windows though.
1 jpye 1853 import os, platform, subprocess
2     from SCons.Script import *
3    
4     def generate(env):
5     """
6     Detect Graphviz settings and add them to the environment.
7     """
8     try:
9     if platform.system()=="Windows":
10     import _winreg
11     x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
12     y= _winreg.OpenKey(x,r"SOFTWARE\graphviz")
13     LIB,t = _winreg.QueryValueEx(y,"INSTALL_LIB")
14     BIN,t = _winreg.QueryValueEx(y,"INSTALL_BIN")
15     INCLUDE,t = _winreg.QueryValueEx(y,"INSTALL_INCLUDE")
16    
17     env['GRAPHVIZ_CPPPATH'] = [INCLUDE]
18     env['GRAPHVIZ_LIBPATH'] = [LIB]
19     env['GRAPHVIZ_LIBS'] = ['graph']
20     env['HAVE_GRAPHVIZ'] = True
21    
22     else:
23     cmd = ['pkg-config','libgvc','libagraph','--cflags','--libs']
24     env1 = env.Copy()
25     env1['CPPPATH'] = None
26     env1['LIBPATH'] = None
27     env1['LIBS'] = None
28     env1.ParseConfig(cmd)
29     env['GRAPHVIZ_CPPPATH'] = env1.get('CPPPATH')
30     env['GRAPHVIZ_LIBPATH'] = env1.get('LIBPATH')
31     env['GRAPHVIZ_LIBS'] = env1.get('LIBS')
32     env['HAVE_GRAPHVIZ'] = True
33    
34     print "GRAPHVIZ_LIBS =",env.get('GRAPHVIZ_LIBS')
35     print "GRAPHVIZ_LIBPATH =",env.get('GRAPHVIZ_LIBPATH')
36     print "GRAPHVIZ_CPPPATH =",env.get('GRAPHVIZ_CPPPATH')
37    
38     except:
39     env['HAVE_GRAPHVIZ'] = False
40    
41     def exists(env):
42     """
43     Make sure this tool exists.
44     """
45     if platform.system()=="Windows":
46     try:
47     import _winreg
48     x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
49     y= _winreg.OpenKey(x,r"SOFTWARE\graphviz")
50     INCLUDE,t = _winreg.QueryValueEx(y,'INSTALL_INCLUDE')
51     return True
52     except:
53     return False
54     else:
55     if not subprocess.call('pkg-config libgvc libagraph --exists'):
56     return True
57     return False
58    

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22