source: trunk/GSASIIpath.py @ 181

Last change on this file since 181 was 181, checked in by vondreele, 12 years ago

add 64bit

File size: 1.3 KB
Line 
1# determine a binary path for the pyd files based on the host OS and the python version, 
2# path is relative to location of the script that is called as well as this file
3# this must be imported before anything that imports any .pyd/.so file for GSASII
4import os.path as ospath
5import sys
6import platform
7bindir = None
8if sys.platform == "win32":
9    if platform.architecture()[0] == '64bit':
10        bindir = 'binwin64-%d.%d' % sys.version_info[0:2]
11    else:
12        bindir = 'binwin%d.%d' % sys.version_info[0:2]
13elif sys.platform == "darwin":
14    bindir = 'binmac%d.%d' % sys.version_info[0:2]
15elif sys.platform == "linux2":
16    bindir = 'binlinux%d.%d' % sys.version_info[0:2]
17for loc in sys.path[0],ospath.split(__file__)[0]:
18    if bindir:
19        if ospath.exists(ospath.join(loc,bindir)) and ospath.join(loc,bindir) not in sys.path: 
20            sys.path.insert(0,ospath.join(loc,bindir))
21        # is there a bin directory? (created by a local compile), if so put
22        # that at the top of the path
23    if ospath.exists(ospath.join(loc,'bin')):
24        bindir = 'bin'
25        if ospath.join(loc,'bin') not in sys.path: 
26            sys.path.insert(0,ospath.join(loc,bindir))
27if bindir == None:
28    print "Warning GSAS-II binary libraries not found, some sections of code will not function"
Note: See TracBrowser for help on using the repository browser.