]> Creatis software - gdcm.git/blob - gdcmPython/demo/gdcmConfigDemo.py.in
Fix mistypings
[gdcm.git] / gdcmPython / demo / gdcmConfigDemo.py.in
1 # gdcmPython Demo configurer
2
3 if __name__!="main":
4    import sys
5    import os
6    import inspect
7    import os.path
8
9    def FindPath():
10       try:
11          path=inspect.getsourcefile(FindPath)
12       except:
13          pass
14       else:
15          if( path ):
16             path=os.path.split(path)[0]
17             file=os.path.join(path,"..","__init__.py")
18             if( os.path.isfile(file) ):
19                gdcmPath=os.path.join(path,"..","..")
20                sys.path.append(gdcmPath)
21                sys.path.append(os.path.join(gdcmPath,"bin"))
22                if( os.name != 'posix' ):
23                   sys.path.append(os.path.join(gdcmPath,"bin","Release"))
24                   sys.path.append(os.path.join(gdcmPath,"bin","Debug"))
25
26    def UseCMakePath():
27       sys.path.append('${GDCM_BINARY_DIR}')
28       sys.path.append('${GDCM_BINARY_DIR}/bin')
29       if( os.name != 'posix' ):
30          sys.path.append('${GDCM_BINARY_DIR}/bin/Release')
31          sys.path.append('${GDCM_BINARY_DIR}/bin/Debug')
32
33    try:
34       mod=__import__("gdcmPython")
35    except:
36       FindPath()
37       try:
38          mod=__import__("gdcmPython")
39       except:
40          UseCMakePath()
41
42 else:
43    print "Only a system configurer for gdcm Demos."
44    print "Can't be executed"
45