Changeset 2924
- Timestamp:
- Jul 8, 2017 3:42:02 PM (6 years ago)
- Location:
- branch/2frame
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/2frame/GSASII.py
r2906 r2924 17 17 18 18 import GSASIIpath 19 GSASIIpath.SetVersionNumber("$Revision$")20 GSASIIpath.InvokeDebugOpts()21 19 22 __version__ = '0.3.0' 23 20 __version__ = '1.0.0' 24 21 25 22 if __name__ == '__main__': 23 GSASIIpath.SetBinaryPath() 24 GSASIIpath.SetVersionNumber("$Revision$") 25 GSASIIpath.InvokeDebugOpts() 26 26 import GSASIIdataGUI as G2gd 27 27 G2gd.GSASIImain() # start the GUI -
branch/2frame/GSASIIctrlGUI.py
r2923 r2924 3504 3504 frame.Bind(wx.EVT_MENU, self.OnSelectVersion, helpobj) 3505 3505 if GSASIIpath.svnTestBranch(): 3506 msg = "&Switch to backstandard GSAS-II version"3506 msg = "&Switch back to standard GSAS-II version" 3507 3507 else: 3508 3508 msg = "&Switch to test (2frame) GSAS-II version" -
branch/2frame/GSASIIpath.py
r2923 r2924 651 651 print(" "+files) 652 652 print("*"*75) 653 ################################################################################ 654 # commands below are executed during the first import of this file 655 ################################################################################ 656 # Add location of GSAS-II shared libraries (binaries: .so or .pyd files) to path 657 binpath = None 658 for loc in os.path.abspath(sys.path[0]),os.path.abspath(os.path.split(__file__)[0]): 659 # Look at bin directory (created by a local compile) before standard dist 660 # that at the top of the path 661 for d in 'bin','bindist': 662 if not d: continue 663 fpth = os.path.join(loc,d) 664 if TestSPG(fpth): 665 binpath = fpth 666 break 667 if binpath: break 668 if binpath: # were GSAS-II binaries found 669 sys.path.insert(0,binpath) 670 print('GSAS-II binary directory: {}'.format(binpath)) 671 else: # try loading them 672 print('Attempting to download GSAS-II binary files...') 673 try: 674 binpath = DownloadG2Binaries(g2home) 675 except AttributeError: # this happens when building in Read The Docs 676 print('Problem with download') 677 if binpath and TestSPG(binpath): 678 print('GSAS-II binary directory: {}'.format(binpath)) 679 sys.path.insert(0,binpath) 680 # this must be imported before anything that imports any .pyd/.so file for GSASII 681 else: 682 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 683 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 684 # patch: use old location based on the host OS and the python version, 685 # path is relative to location of the script that is called as well as this file 686 bindir = None 687 if sys.platform == "win32": 688 if platform.architecture()[0] == '64bit': 689 bindir = 'binwin64-%d.%d' % sys.version_info[0:2] 690 else: 691 bindir = 'binwin%d.%d' % sys.version_info[0:2] 692 elif sys.platform == "darwin": 693 if platform.architecture()[0] == '64bit': 694 bindir = 'binmac64-%d.%d' % sys.version_info[0:2] 695 else: 696 bindir = 'binmac%d.%d' % sys.version_info[0:2] 697 #if platform.mac_ver()[0].startswith('10.5.'): 698 # bindir += '_10.5' 699 elif sys.platform == "linux2": 700 if platform.architecture()[0] == '64bit': 701 bindir = 'binlinux64-%d.%d' % sys.version_info[0:2] 702 else: 703 bindir = 'binlinux%d.%d' % sys.version_info[0:2] 704 for loc in os.path.abspath(sys.path[0]),os.path.abspath(os.path.split(__file__)[0]): 653 654 BinaryPathLoaded = False 655 def SetBinaryPath(): 656 ''' 657 Add location of GSAS-II shared libraries (binaries: .so or .pyd files) to path 658 659 This routine must be executed after GSASIIpath is imported and before any other 660 GSAS-II imports are done. 661 ''' 662 # do this only once no matter how many times it is called 663 global BinaryPathLoaded 664 if BinaryPathLoaded: return 665 BinaryPathLoaded = True 666 binpath = None 667 for loc in os.path.abspath(sys.path[0]),os.path.abspath(os.path.split(__file__)[0]): 705 668 # Look at bin directory (created by a local compile) before standard dist 706 669 # that at the top of the path 707 fpth = os.path.join(loc,bindir) 708 binpath = fpth 670 for d in 'bin','bindist': 671 if not d: continue 672 fpth = os.path.join(loc,d) 709 673 if TestSPG(fpth): 710 sys.path.insert(0,binpath) 711 print('\n'+75*'*') 712 print(' Warning. Using an old-style GSAS-II binary library. This is unexpected') 713 print(' and will break in future GSAS-II versions. Please contact toby@anl.gov') 714 print(' so we can learn what is not working on your installation.') 715 print('GSAS-II binary directory: {}'.format(binpath)) 674 binpath = fpth 675 break 676 if binpath: break 677 if binpath: # were GSAS-II binaries found 678 sys.path.insert(0,binpath) 679 print('GSAS-II binary directory: {}'.format(binpath)) 680 else: # try loading them 681 print('Attempting to download GSAS-II binary files...') 682 try: 683 binpath = DownloadG2Binaries(g2home) 684 except AttributeError: # this happens when building in Read The Docs 685 print('Problem with download') 686 if binpath and TestSPG(binpath): 687 print('GSAS-II binary directory: {}'.format(binpath)) 688 sys.path.insert(0,binpath) 689 # this must be imported before anything that imports any .pyd/.so file for GSASII 690 else: 691 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 692 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 693 # patch: use old location based on the host OS and the python version, 694 # path is relative to location of the script that is called as well as this file 695 bindir = None 696 if sys.platform == "win32": 697 if platform.architecture()[0] == '64bit': 698 bindir = 'binwin64-%d.%d' % sys.version_info[0:2] 699 else: 700 bindir = 'binwin%d.%d' % sys.version_info[0:2] 701 elif sys.platform == "darwin": 702 if platform.architecture()[0] == '64bit': 703 bindir = 'binmac64-%d.%d' % sys.version_info[0:2] 704 else: 705 bindir = 'binmac%d.%d' % sys.version_info[0:2] 706 #if platform.mac_ver()[0].startswith('10.5.'): 707 # bindir += '_10.5' 708 elif sys.platform == "linux2": 709 if platform.architecture()[0] == '64bit': 710 bindir = 'binlinux64-%d.%d' % sys.version_info[0:2] 711 else: 712 bindir = 'binlinux%d.%d' % sys.version_info[0:2] 713 for loc in os.path.abspath(sys.path[0]),os.path.abspath(os.path.split(__file__)[0]): 714 # Look at bin directory (created by a local compile) before standard dist 715 # that at the top of the path 716 fpth = os.path.join(loc,bindir) 717 binpath = fpth 718 if TestSPG(fpth): 719 sys.path.insert(0,binpath) 720 print('\n'+75*'*') 721 print(' Warning. Using an old-style GSAS-II binary library. This is unexpected') 722 print(' and will break in future GSAS-II versions. Please contact toby@anl.gov') 723 print(' so we can learn what is not working on your installation.') 724 print('GSAS-II binary directory: {}'.format(binpath)) 725 print(75*'*') 726 break 727 else: 728 # end patch 729 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 730 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 716 731 print(75*'*') 717 break 718 else: 719 # end patch 720 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 721 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 722 print(75*'*') 723 print('Use of GSAS-II binary directory {} failed!'.format(binpath)) 724 print(75*'*') 725 raise Exception,"**** ERROR GSAS-II binary libraries not found, GSAS-II cannot run ****" 726 727 # add the data import and export directory to the search path 728 newpath = os.path.join(path2GSAS2,'imports') 729 if newpath not in sys.path: sys.path.append(newpath) 730 newpath = os.path.join(path2GSAS2,'exports') 731 if newpath not in sys.path: sys.path.append(newpath) 732 733 # setup read of config.py, if present 734 try: 735 import config 736 configDict = config.__dict__ 737 import inspect 738 vals = [True for i in inspect.getmembers(config) if '__' not in i[0]] 739 print str(len(vals))+' values read from config file '+os.path.abspath(config.__file__) 740 except ImportError: 741 configDict = {'Clip_on':True} 742 except Exception as err: 743 print("Error importing config.py file: "+str(err)) 744 configDict = {'Clip_on':True} 732 print('Use of GSAS-II binary directory {} failed!'.format(binpath)) 733 print(75*'*') 734 raise Exception,"**** ERROR GSAS-II binary libraries not found, GSAS-II cannot run ****" 735 736 # add the data import and export directory to the search path 737 newpath = os.path.join(path2GSAS2,'imports') 738 if newpath not in sys.path: sys.path.append(newpath) 739 newpath = os.path.join(path2GSAS2,'exports') 740 if newpath not in sys.path: sys.path.append(newpath) 741 742 # setup read of config.py, if present 743 global configDict 744 try: 745 import config 746 configDict = config.__dict__ 747 import inspect 748 vals = [True for i in inspect.getmembers(config) if '__' not in i[0]] 749 print str(len(vals))+' values read from config file '+os.path.abspath(config.__file__) 750 except ImportError: 751 configDict = {'Clip_on':True} 752 except Exception as err: 753 print("Error importing config.py file: "+str(err)) 754 configDict = {'Clip_on':True} 745 755 746 756 if __name__ == '__main__': -
branch/2frame/GSASIIstrMain.py
r2900 r2924 767 767 768 768 if __name__ == '__main__': 769 GSASIIpath.SetBinaryPath() 769 770 main()
Note: See TracChangeset
for help on using the changeset viewer.