Changeset 4238 for install/g2complete/src/bootstrap.py
- Timestamp:
- Jan 8, 2020 7:30:23 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
install/g2complete/src/bootstrap.py
r3934 r4238 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 … … 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','OpenGL',]: 224 exec('import '+pkg) 225 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) 226 243 227 244 if not skipDownloadSteps: … … 231 248 svn = whichsvn() # resets host & port if proxyinfo.txt is found 232 249 if not svn: 233 print("Sorry, subversion (svn) could not be found on your system.")234 print("Please install this or place in path and rerun this.")235 #raise Exception('Subversion (svn) not found')236 sys.exit()237 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) 238 255 239 256 #if install_with_easyinstall: … … 354 371 cmd = [svn, 'cleanup', path2GSAS2] 355 372 s = subprocess.Popen(cmd,stderr=subprocess.PIPE) 356 out,err = s.communicate()373 out,err = MakeByte2str(s.communicate()) 357 374 if err: 358 375 print('subversion returned an error:') … … 366 383 s = subprocess.Popen(cmd,stderr=subprocess.PIPE) 367 384 print('\nsubversion output:') 368 out,err = s.communicate()385 out,err = MakeByte2str(s.communicate()) 369 386 if err: 370 387 print('subversion returned an error:') … … 381 398 print(msg) 382 399 s = subprocess.Popen(cmd,stderr=subprocess.PIPE) 383 out,err = s.communicate()400 out,err = MakeByte2str(s.communicate()) 384 401 if err: 385 print('subversion returned an error:') 386 print(err) 387 print(' *** GSAS-II failed to be installed. A likely reason is a network access') 388 print(' *** problem, most commonly because you need to use a network proxy. Please') 389 print(' *** check with a network administrator or use http://www.whatismyproxy.com/\n') 390 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) 391 414 print('\n'+75*'*') 392 415 … … 395 418 print('import of GSASIIpath completed') 396 419 except Exception as err: 397 print('\n'+75*'=') 398 print('Failed with import of GSASIIpath. This is unexpected.') 399 print('GSAS-II will not run without correcting this. Contact toby@anl.gov') 400 print(err) 401 print(75*'=') 402 sys.exit() 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) 403 423 404 424 if allBinaries and not skipDownloadSteps: 405 425 print('Loading all binaries with command...') 406 426 if not GSASIIpath.svnSwitchDir('AllBinaries','',g2home+ 'Binaries/',None,True): 407 print('Binary load failed')408 sys.exit()427 msg = 'Binary load failed' 428 BailOut(msg) 409 429 else: 410 430 GSASIIpath.DownloadG2Binaries(g2home) … … 430 450 p = subprocess.Popen([sys.executable,'-c',script],stdout=subprocess.PIPE,stderr=subprocess.PIPE, 431 451 cwd=path2GSAS2) 432 res,err = p.communicate()452 res,err = MakeByte2str(p.communicate()) 433 453 if '==OK==' not in str(res) or p.returncode != 0: 434 print('\n'+75*'=')435 print('Failed when testing the GSAS-II compiled files. GSAS-II will not run')436 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' 437 457 if res: 438 print(res.decode()) 458 msg += res.decode() 459 msg += '\n' 439 460 if err: 440 print(err.decode())461 msg += err.decode() 441 462 #print('\nAttempting to open a web page on compiling GSAS-II...') 442 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) 443 465 #import webbrowser 444 466 #webbrowser.open_new('https://subversion.xray.aps.anl.gov/trac/pyGSAS/wiki/CompileGSASII') 445 print(75*'=')467 #print(75*'=') 446 468 # if '86' in platform.machine() and (sys.platform.startswith('linux') 447 469 # or sys.platform == "darwin" … … 450 472 # else: 451 473 # print('Platform '+sys.platform+' with processor type '+platform.machine()+' not is supported') 452 sys.exit()453 474 else: 454 475 print('Successfully tested compiled routines')
Note: See TracChangeset
for help on using the changeset viewer.