def check_environment(): '''Check the environment we are running in...''' if sys.hexversion < 0x02070000: raise RuntimeError('Python versions older than 2.7 are not supported') import cctbx executable = sys.executable cctbx_dir = os.sep.join(cctbx.__file__.split(os.sep)[:-3]) # to help wrapper code - print process id... Debug.write('Process ID: %d' % os.getpid()) Chatter.write('Environment configuration...') Chatter.write('Python => %s' % executable) Chatter.write('CCTBX => %s' % cctbx_dir) ccp4_keys = ['CCP4', 'CLIBD', 'CCP4_SCR'] for k in ccp4_keys: v = Environment.getenv(k) if not v: raise RuntimeError('%s not defined - is CCP4 set up?' % k) if not v == v.strip(): raise RuntimeError('spaces around "%s"' % v) Chatter.write('%s => %s' % (k, v)) from xia2.Handlers.Flags import Flags Chatter.write('Starting directory: %s' % Flags.get_starting_directory()) Chatter.write('Working directory: %s' % os.getcwd()) # temporary workaround to bug in pointless... if ' ' in os.getcwd(): raise RuntimeError('Space in working directory ' \ '(https://github.com/xia2/xia2/issues/114)') Chatter.write('Free space: %.2f GB' % (df() / math.pow(2, 30))) try: if os.name == 'nt': hostname = os.environ['COMPUTERNAME'].split('.')[0] else: hostname = os.environ['HOSTNAME'].split('.')[0] Chatter.write('Host: %s' % hostname) except KeyError: pass Chatter.write('Contact: [email protected]') Chatter.write(Version)
def check_environment(): """Check the environment we are running in...""" if sys.hexversion < 0x02070000: raise RuntimeError("Python versions older than 2.7 are not supported") import cctbx executable = sys.executable cctbx_dir = os.sep.join(cctbx.__file__.split(os.sep)[:-3]) # to help wrapper code - print process id... Debug.write("Process ID: %d" % os.getpid()) Chatter.write("Environment configuration...") Chatter.write("Python => %s" % executable) Chatter.write("CCTBX => %s" % cctbx_dir) ccp4_keys = ["CCP4", "CLIBD", "CCP4_SCR"] for k in ccp4_keys: v = Environment.getenv(k) if not v: raise RuntimeError("%s not defined - is CCP4 set up?" % k) if not v == v.strip(): raise RuntimeError('spaces around "%s"' % v) Chatter.write("%s => %s" % (k, v)) from xia2.Handlers.Flags import Flags Chatter.write("Starting directory: %s" % Flags.get_starting_directory()) Chatter.write("Working directory: %s" % os.getcwd()) Chatter.write("Free space: %.2f GB" % (df() / math.pow(2, 30))) hostname = platform.node().split(".")[0] Chatter.write("Host: %s" % hostname) Chatter.write("Contact: [email protected]") Chatter.write(Version) # temporary workaround to bug in pointless... if " " in os.getcwd(): raise RuntimeError("Space in working directory " "(https://github.com/xia2/xia2/issues/114)")