- Timestamp:
- Jan 9, 2020 2:29:00 PM (4 years ago)
- Location:
- install
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
install/bootstrap.py
r3910 r4239 12 12 skipDownloadSteps = False 13 13 skipProxy = False 14 showWXerror = False 14 15 help = False 15 16 allBinaries = False … … 17 18 if 'noinstall' in a.lower(): 18 19 skipInstallSteps = True 20 showWXerror = True 19 21 elif 'nonet' in a.lower(): 20 22 skipDownloadSteps = True … … 51 53 ################################################################################ 52 54 ################################################################################ 55 def BailOut(msg): 56 '''Exit with an error message. Use a GUI to show the error when 57 showWXerror == True (when --noinstall is specified) 58 ''' 59 print(msg) 60 if showWXerror: 61 import wx 62 app = wx.App() 63 app.MainLoop() 64 dlg = wx.MessageDialog(None,msg,'GSAS-II installation error', 65 wx.OK | wx.ICON_ERROR | wx.STAY_ON_TOP) 66 dlg.Raise() 67 dlg.ShowModal() 68 dlg.Destroy() 69 sys.exit() 70 53 71 def GetConfigValue(*args): return True 54 72 # routines copied from GSASIIpath.py … … 213 231 missing.append(pkg) 214 232 215 if missing :233 if missing and not skipInstallSteps: 216 234 msg = """Sorry, this version of Python cannot be used 217 235 for GSAS-II. It is missing the following package(s): 218 236 \t""" 219 237 for pkg in missing: msg += " "+pkg 220 print(msg) 221 print("\nPlease install these package(s) and try running this again.") 222 print("Showing first error: ") 223 for pkg in ['numpy','scipy','matplotlib','wx',]: 224 exec('import '+pkg) 225 sys.exit() 226 # try: 227 # import OpenGL 228 # install_with_easyinstall = None 229 # except: 230 # try: 231 # from setuptools.command import easy_install 232 # except ImportError: 233 # print('You are missing the OpenGL Python package. This can be ') 234 # print('installed by this script if the setuptools package is installed') 235 # print('Please install either OpenGL (pyopengl) or setuptools') 236 # print("package and try running this again.") 237 # sys.exit() 238 # print("Missing the OpenGL Python package. Will attempt to install this later.") 239 # def install_with_easyinstall(package): 240 # try: 241 # print("trying system-wide ") 242 # easy_install.main(['-f',os.path.split(__file__)[0],package]) 243 # return 244 # except: 245 # pass 246 # try: 247 # print("trying user level ") 248 # easy_install.main(['-f',os.path.split(__file__)[0],'--user',package]) 249 # return 250 # except: 251 # print("\nInstall of "+package+" failed. Error traceback follows:") 252 # import traceback 253 # print(traceback.format_exc()) 254 # sys.exit() 238 msg += "\nPlease install these package(s) and try running bootstrap.py again." 239 #print("Showing first error: ") 240 #for pkg in ['numpy','scipy','matplotlib','wx','OpenGL',]: 241 # exec('import '+pkg) 242 BailOut(msg) 255 243 256 244 if not skipDownloadSteps: … … 260 248 svn = whichsvn() # resets host & port if proxyinfo.txt is found 261 249 if not svn: 262 print("Sorry, subversion (svn) could not be found on your system.")263 print("Please install this or place in path and rerun this.")264 #raise Exception('Subversion (svn) not found')265 sys.exit()266 print(' found svn image: '+svn)250 msg ="Sorry, subversion (svn) could not be found on your system." 251 msg += "\nPlease install this or place in path and rerun this." 252 BailOut(msg) 253 else: 254 print(' found svn image: '+svn) 267 255 268 256 #if install_with_easyinstall: … … 297 285 key = i 298 286 break 287 val = '' 299 288 if key: 300 289 val = os.environ[key].strip() 290 if val: 301 291 if val[-1] == '/': 302 292 val = val[:-1] … … 381 371 cmd = [svn, 'cleanup', path2GSAS2] 382 372 s = subprocess.Popen(cmd,stderr=subprocess.PIPE) 383 out,err = s.communicate()373 out,err = MakeByte2str(s.communicate()) 384 374 if err: 385 375 print('subversion returned an error:') … … 393 383 s = subprocess.Popen(cmd,stderr=subprocess.PIPE) 394 384 print('\nsubversion output:') 395 out,err = s.communicate()385 out,err = MakeByte2str(s.communicate()) 396 386 if err: 397 387 print('subversion returned an error:') … … 408 398 print(msg) 409 399 s = subprocess.Popen(cmd,stderr=subprocess.PIPE) 410 out,err = s.communicate()400 out,err = MakeByte2str(s.communicate()) 411 401 if err: 412 print('subversion returned an error:') 413 print(err) 414 print(' *** GSAS-II failed to be installed. A likely reason is a network access') 415 print(' *** problem, most commonly because you need to use a network proxy. Please') 416 print(' *** check with a network administrator or use http://www.whatismyproxy.com/\n') 417 sys.exit() 402 msg = 'subversion returned an error:\n' 403 msg += err 404 if os.path.exists(os.path.join(path2GSAS2,"makeBat.py")): 405 msg += '\n\nGSAS-II failed to be updated. A likely reason is a network access' 406 msg += '\nproblem. If your web browser works, but the update did not.' 407 msg += '\nThe most common reason is you need to use a network proxy. Please' 408 msg += '\ncheck with a network administrator or use http://www.whatismyproxy.com/' 409 else: 410 msg += '\n\n *** GSAS-II failed to be installed. A likely reason is a network access' 411 msg += '\n *** problem, most commonly because you need to use a network proxy. Please' 412 msg += ' *** check with a network administrator or use http://www.whatismyproxy.com/\n' 413 BailOut(msg) 418 414 print('\n'+75*'*') 419 415 … … 422 418 print('import of GSASIIpath completed') 423 419 except Exception as err: 424 print('\n'+75*'=') 425 print('Failed with import of GSASIIpath. This is unexpected.') 426 print('GSAS-II will not run without correcting this. Contact toby@anl.gov') 427 print(err) 428 print(75*'=') 429 sys.exit() 430 431 if allBinaries and skipDownloadSteps: 420 msg = 'Failed with import of GSASIIpath. This is unexpected.' 421 msg += '\nGSAS-II will not run without correcting this. Contact toby@anl.gov' 422 BailOut(msg) 423 424 if allBinaries and not skipDownloadSteps: 432 425 print('Loading all binaries with command...') 433 426 if not GSASIIpath.svnSwitchDir('AllBinaries','',g2home+ 'Binaries/',None,True): 434 print('Binary load failed')435 sys.exit()427 msg = 'Binary load failed' 428 BailOut(msg) 436 429 else: 437 430 GSASIIpath.DownloadG2Binaries(g2home) … … 457 450 p = subprocess.Popen([sys.executable,'-c',script],stdout=subprocess.PIPE,stderr=subprocess.PIPE, 458 451 cwd=path2GSAS2) 459 res,err = p.communicate()452 res,err = MakeByte2str(p.communicate()) 460 453 if '==OK==' not in str(res) or p.returncode != 0: 461 print('\n'+75*'=')462 print('Failed when testing the GSAS-II compiled files. GSAS-II will not run')463 print('without correcting this.\n\nError message:')454 #print('\n'+75*'=') 455 msg = 'Failed when testing the GSAS-II compiled files. GSAS-II will not run' 456 msg += ' without correcting this.\n\nError message:\n' 464 457 if res: 465 print(res.decode()) 458 msg += res.decode() 459 msg += '\n' 466 460 if err: 467 print(err.decode())461 msg += err.decode() 468 462 #print('\nAttempting to open a web page on compiling GSAS-II...') 469 print('Please see web page\nhttps://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII') 463 msg += '\n\nPlease see web page\nhttps://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII' 464 BailOut(msg) 470 465 #import webbrowser 471 466 #webbrowser.open_new('https://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII') 472 print(75*'=')467 #print(75*'=') 473 468 # if '86' in platform.machine() and (sys.platform.startswith('linux') 474 469 # or sys.platform == "darwin" … … 477 472 # else: 478 473 # print('Platform '+sys.platform+' with processor type '+platform.machine()+' not is supported') 479 sys.exit()480 474 else: 481 475 print('Successfully tested compiled routines') -
install/g2complete/src/bootstrap.py
r4238 r4239 404 404 if os.path.exists(os.path.join(path2GSAS2,"makeBat.py")): 405 405 msg += '\n\nGSAS-II failed to be updated. A likely reason is a network access' 406 msg += '\nproblem. If your web browser works, but the update did not '407 msg += '\n the most common reason is you need to use a network proxy. Please'406 msg += '\nproblem. If your web browser works, but the update did not.' 407 msg += '\nThe most common reason is you need to use a network proxy. Please' 408 408 msg += '\ncheck with a network administrator or use http://www.whatismyproxy.com/' 409 409 else: -
install/setversion.py
r3912 r4239 1 import sys 2 import platform 1 3 import subprocess 2 4 … … 39 41 fp = open(fil+'.template','r') 40 42 out = fp.read().replace('**Version**',version) 43 if sys.platform == "win32" and platform.architecture()[0] != '64bit': 44 print('changing for 32-bit windows' 45 out = out.replace('win-64','win-32') 41 46 fp.close() 42 47 print('Creating',fil)
Note: See TracChangeset
for help on using the changeset viewer.