Changeset 669
- Timestamp:
- Jun 30, 2012 8:37:47 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
install/bootstrap.py
r333 r669 2 2 import os, stat, sys, platform, subprocess 3 3 home = 'https://subversion.xor.aps.anl.gov/pyGSAS/' 4 print 70*'*' 5 print 'Checking python packages...', 6 missing = [] 7 for pkg in ['numpy','scipy','matplotlib','wx']: 8 try: 9 exec('import '+pkg) 10 except: 11 missing.append(pkg) 4 12 5 print sys.argv 13 if missing: 14 print """Sorry, this version of Python cannot be used 15 for GSAS-II. It is missing the following package(s): 16 \t""", 17 for pkg in missing: print " ",pkg, 18 print 19 print "We suggest installing the EPDfree package at\nhttp://www.enthought.com/products/epd_free.php/" 20 sys.exit() 21 6 22 gsaspath = os.path.split(sys.argv[0])[0] 7 23 gsaspath = os.path.abspath(os.path.expanduser(gsaspath)) … … 17 33 print 'OK' 18 34 19 print 'GSAS-II is being bootstrapped from repository\n ',home,'\nto '+gsaspath35 print 'GSAS-II is being bootstrapped from repository\n\t',home,'\nto '+gsaspath 20 36 21 37 print 'Determining system type...', … … 56 72 script = ''' 57 73 (* GSAS-II AppleScript by B. Toby (brian.toby@anl.gov) 58 It can launch GSAS-II by double clicking or by dropping a data file or folder over that app. 59 thanks to F. Farges; farges@univ-mlv.fr for showing me how to do much of this 74 It can launch GSAS-II by double clicking or by dropping a data file 75 or folder over the app. 76 It runs GSAS-II in a terminal window. 77 78 Thanks to F. Farges (farges@univ-mlv.fr) for many applescript tricks 60 79 *) 61 80 … … 77 96 if (file appwithpath exists) then 78 97 else 79 display dialog "Error: file " & appwithpath & " not found. This AppleScript must be run from a directory containing the GSAS-II executable. Did you move it?" with icon caution buttons {"Quit"}98 display dialog "Error: file " & appwithpath & " not found. This AppleScript must be run from a directory containing the GSAS-II python code. Did you move it?" with icon caution buttons {"Quit"} 80 99 return 81 100 end if … … 92 111 *) 93 112 on run 94 set python to " %s"113 set python to "/Library/Frameworks/Python.framework/Versions/7.1/Resources/Python.app/Contents/MacOS/Python" 95 114 set myPath to (path to me) 96 115 set ParentPath to GetParentPath(myPath) … … 98 117 TestFilePresent(appwithpath) 99 118 set posixapp to quoted form of the POSIX path of appwithpath 100 set results to do shell script python & " " & posixapp & " > ~/GSASIIerrors 2>&1 &" 119 tell application "Terminal" 120 activate 121 do script python & " " & posixapp & "; exit" 122 end tell 101 123 end run 102 124 … … 115 137 on open names 116 138 117 set python to " %s"139 set python to "/Library/Frameworks/Python.framework/Versions/7.1/Resources/Python.app/Contents/MacOS/Python" 118 140 set myPath to (path to me) 119 141 set ParentPath to GetParentPath(myPath) … … 127 149 set myfile to choose file default location filename with prompt "Select a GSAS-II input file" multiple selections allowed no 128 150 set myfile to the quoted form of the POSIX path of myfile 129 set results to do shell script python & " " & posixapp & " " & myfile & " > ~/GSASIIerrors 2>&1 &" 151 tell application "Terminal" 152 activate 153 do script python & " " & posixapp & " " & myfile & "; exit" 154 end tell 130 155 else 131 156 (* if this is an input file, open it *) 132 157 set filename to the quoted form of the POSIX path of filename 133 set results to do shell script python & " " & posixapp & " " & filename & " > ~/GSASIIerrors 2>&1 &" 158 tell application "Terminal" 159 activate 160 do script python & " " & posixapp & " " & filename & "; exit" 161 end tell 134 162 end if 135 163 end repeat … … 142 170 p.communicate() 143 171 if os.path.exists('GSAS2.rsrc'): 144 print "Note: ignore the -d warning from osacompile"172 print "Note: ignore the previous -d warning from osacompile" 145 173 p = subprocess.call(['/Developer/Tools/Rez','-append','GSAS2.rsrc','-o',app + "/Icon\r"]) 146 174 p = subprocess.call(['/Developer/Tools/SetFile','-a','C',app])
Note: See TracChangeset
for help on using the changeset viewer.