Changeset 2852
- Timestamp:
- Jun 2, 2017 4:52:19 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIpath.py ¶
r2682 r2852 20 20 import sys 21 21 import platform 22 import glob 22 23 # see if a directory for local modifications is defined. If so, stick that in the path 23 24 if os.path.exists(os.path.expanduser('~/.G2local/')): … … 62 63 else: 63 64 bindir = 'binlinux%d.%d' % sys.version_info[0:2] 64 for loc in sys.path[0],os.path.abspath(os.path.split(__file__)[0]): 65 if bindir: 66 if os.path.exists(os.path.join(loc,bindir)) and os.path.join(loc,bindir) not in sys.path: 67 sys.path.insert(0,os.path.join(loc,bindir)) 68 # is there a bin directory? (created by a local compile), if so put 69 # that at the top of the path 70 if os.path.exists(os.path.join(loc,'bin')) and os.path.getsize(os.path.join(loc,'bin')): 71 bindir = 'bin' 72 if os.path.join(loc,'bin') not in sys.path: 73 sys.path.insert(0,os.path.join(loc,bindir)) 74 print 'GSAS-II binary directory: ',os.path.join(loc,bindir) 75 if bindir == None: 65 binpath = None 66 # scan the first directory in path as well as the location of current file 67 # for location of GSAS-II shared libraries (binaries: .so or .pyd files) 68 for loc in os.path.abspath(sys.path[0]),os.path.abspath(os.path.split(__file__)[0]): 69 # Look at bin directory (created by a local compile) before standard dist 70 # that at the top of the path 71 for d in 'bin',bindir: 72 if not d: continue 73 fpth = os.path.join(loc,d) 74 if not os.path.exists(fpth): continue 75 if not glob.glob(os.path.join(fpth,'pyspg.*')): continue 76 savpath = sys.path[:] 77 sys.path.insert(0,fpth) 78 # test to see if a shared library can be used 79 try: 80 import pyspg 81 pyspg.sgforpy('P -1') 82 except Exception as err: 83 print(70*'=') 84 print('Failed to run pyspg in {}\nerror: {}'.format(fpth,err)) 85 print(70*'=') 86 sys.path = savpath 87 continue 88 binpath = fpth 89 break 90 if binpath: break 91 if binpath: 92 print('GSAS-II binary directory: {}'.format(binpath)) 93 else: 76 94 raise Exception,"**** ERROR GSAS-II binary libraries not found, GSAS-II fails ****" 77 95 # add the data import and export directory to the search path
Note: See TracChangeset
for help on using the changeset viewer.