/[ascend]/trunk/pygtk/ascend.in
ViewVC logotype

Diff of /trunk/pygtk/ascend.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2082 by jpye, Mon Sep 21 15:21:06 2009 UTC revision 2083 by jpye, Thu Sep 24 06:37:53 2009 UTC
# Line 5  import os.path, sys, platform Line 5  import os.path, sys, platform
5    
6  restart = 0  restart = 0
7    
8  # This script handles restarting ascend if it's invoked without the full  # This script launched ASCEND, after first ensuring that all necessary
9  # complement of env vars. You can override values used by this script  # variables are present in the 'environment', and adding them and
10  # by setting the appropriate env vars before this script is run.  # restarting the process if necessary. You can override values for these
11    # env vars by setting them before this script is run.
12    
13  # Note that as well as env vars, ASCEND is also controllable using the  # Note that as well as env vars, ASCEND PyGTK is also controllable using the
14  # .ascend.ini file in the user's home directory.  # .ascend.ini file in the user's home directory.
15    
16    def path_absolute(p):
17        if os.path.isabs(p):
18            return p
19        else:
20            return os.path.join(sys.path[0],p)
21    
22  #-----------------------------------------------------------------------  #-----------------------------------------------------------------------
23  # Get locations of the installed files. On windows, these are defined in  # Get locations of the installed files. On windows, these are defined in
24  # in the registry. On other systems, these are defined at compile time  # in the registry. On other systems, these are defined at compile time
25  # by @VARNAME@ substitution.  # by @VARNAME@ substitution.
26    
27    SEP = ":"
28    PYTHON="@PYTHON@"
29    GTKLIBS = "" # assume the GTK will be in the standard library path
30    
31  if platform.system()=="Windows":  if platform.system()=="Windows":
32        SEP=";"
33        LDPATHVAR = 'PATH'
34        PYTHON=os.path.join(sys.prefix,"pythonw.exe")
35    
36      import _winreg as wreg      import _winreg as wreg
37      k = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, "SOFTWARE\ASCEND")      k = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, "SOFTWARE\ASCEND")
     print k  
38    
39      # on Windows, we should be able to *assume* relative paths...      # on Windows, we should be able to *assume* relative paths...
40    
# Line 34  if platform.system()=="Windows": Line 48  if platform.system()=="Windows":
48            
49      INSTALL_PYTHON = os.path.join(INSTALL_ASCDATA,"python")      INSTALL_PYTHON = os.path.join(INSTALL_ASCDATA,"python")
50      PYVERSION = "@PYVERSION@"      PYVERSION = "@PYVERSION@"
51      PYTHON=os.path.join(sys.prefix,"pythonw.exe")  
       
     print "PYTHON =",PYTHON  
     SEP=";"  
     LDPATHVAR = 'PATH'  
52  elif platform.system()=="Darwin":  elif platform.system()=="Darwin":
53      import os  
54      olddir = os.getcwd()      LDPATHVAR = 'DYLD_LIBRARY_PATH'
55      sys.path.insert(0,os.path.join(sys.path[0],"Python"))  
56      import gtkbrowser      # FIXME
57      os.chdir(olddir)      #GTKLIBS="/Users/john/gtk/inst/lib"
58    
59      # TODO add ASCEND.app/Contents to DYLD_LIBRARY_PATH the restart      INSTALL_LIB = path_absolute(".")
60        INSTALL_ASCDATA = path_absolute("Resources")
61      b = gtkbrowser.Browser()      INSATLL_MODELS = path_absolute("""@ASC_LIBRARY_REL_DIST@""")
62      b.run()      INSTALL_SOLVERS = path_absolute("""@ASC_SOLVERS_REL_DIST@""")
63      sys.exit(0)      INSTALL_PYTHON = path_absolute("Python")
64    
65  else:  else:
66        LDPATHVAR = 'LD_LIBRARY_PATH'
67    
68      # FIXME for possible case of relative paths...      # FIXME for possible case of relative paths...
69    
# Line 61  else: Line 72  else:
72      INSTALL_MODELS = "@INSTALL_MODELS@"      INSTALL_MODELS = "@INSTALL_MODELS@"
73      INSTALL_SOLVERS = "@INSTALL_SOLVERS@"      INSTALL_SOLVERS = "@INSTALL_SOLVERS@"
74      INSTALL_PYTHON = "@INSTALL_PYTHON@"      INSTALL_PYTHON = "@INSTALL_PYTHON@"
     PYTHON="@PYTHON@"  
75      DEFAULT_ASCENDLIBRARY="""@DEFAULT_ASCENDLIBRARY@"""      DEFAULT_ASCENDLIBRARY="""@DEFAULT_ASCENDLIBRARY@"""
     SEP=":"  
     LDPATHVAR = 'LD_LIBRARY_PATH'  
     GTKLIBS = None # assume the GTK will be in the standard library path  
   
     if platform.system()=="Darwin":  
         LDPATHVAR="DYLD_LIBRARY_PATH"  
         GTKLIBS="/Users/john/gtk/inst/lib"  
76    
77  #-----------------------------------------------------------------------  #-----------------------------------------------------------------------
78    
# Line 81  else: Line 84  else:
84  if not os.environ.get('ASC_GDB'):  if not os.environ.get('ASC_GDB'):
85      # restarting messes up GDB so don't allow it      # restarting messes up GDB so don't allow it
86    
87      if platform.system()=="Windows" or platform.system()=="Darwin":      if platform.system()=="Windows" :
88          # Put INSTALL_LIB then GTK at start of path          # Put INSTALL_LIB then GTK at start of path
89          if GTKLIBS not in LDPATH:          if GTKLIBS not in LDPATH:
90              restart = 1              restart = 1

Legend:
Removed from v.2082  
changed lines
  Added in v.2083

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