source: trunk/GSASIIpath.py @ 584

Last change on this file since 584 was 584, checked in by vondreele, 11 years ago

add coding line everywhere
more options in sample parm copy

  • Property svn:keywords set to Date Author Revision URL Id
File size: 1.5 KB
Line 
1# -*- coding: utf-8 -*-
2# determine a binary path for the pyd files based on the host OS and the python version, 
3# path is relative to location of the script that is called as well as this file
4# this must be imported before anything that imports any .pyd/.so file for GSASII
5import os.path as ospath
6import sys
7import platform
8bindir = None
9if sys.platform == "win32":
10    if platform.architecture()[0] == '64bit':
11        bindir = 'binwin64-%d.%d' % sys.version_info[0:2]
12    else:
13        bindir = 'binwin%d.%d' % sys.version_info[0:2]
14elif sys.platform == "darwin":
15    bindir = 'binmac%d.%d' % sys.version_info[0:2]
16    import platform
17    if platform.mac_ver()[0].startswith('10.5.'):
18        bindir += '_10.5'
19elif sys.platform == "linux2":
20    if platform.architecture()[0] == '64bit':
21        bindir = 'binlinux64-%d.%d' % sys.version_info[0:2]
22    else:
23        bindir = 'binlinux%d.%d' % sys.version_info[0:2]
24for loc in sys.path[0],ospath.split(__file__)[0]:
25    if bindir:
26        if ospath.exists(ospath.join(loc,bindir)) and ospath.join(loc,bindir) not in sys.path: 
27            sys.path.insert(0,ospath.join(loc,bindir))
28        # is there a bin directory? (created by a local compile), if so put
29        # that at the top of the path
30    if ospath.exists(ospath.join(loc,'bin')):
31        bindir = 'bin'
32        if ospath.join(loc,'bin') not in sys.path: 
33            sys.path.insert(0,ospath.join(loc,bindir))
34if bindir == None:
35    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.