def get_invoke_run_sate_command(): """Used by GUI's this tries to return the python invocation for the run_sate program or script. """ if sate.sate_is_frozen(): if platform.system() == 'Windows': return ['run_sate.exe'] elif platform.system() == 'Darwin': return [filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path(os.path.join(sate.sate_home_dir(), 'run_sate.py'))] else: raise OSError('SATe is not frozen for %s' % platform.system()) else: return [filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path(os.path.join(sate.sate_home_dir(), 'run_sate.py'))]
def get_invoke_run_sate_command(): """Used by GUI's this tries to return the python invocation for the run_sate program or script. """ if sate.sate_is_frozen(): if platform.system() == 'Windows': return ['run_sate.exe'] elif platform.system() == 'Darwin': return [ filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path( os.path.join(sate.sate_home_dir(), 'run_sate.py')) ] else: raise OSError('SATe is not frozen for %s' % platform.system()) else: return [ filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path( os.path.join(sate.sate_home_dir(), 'run_sate.py')) ]
def _exe_run_sate(self, args, stdout=None, stderr=None, rc=0): script_path = os.path.join(sate.sate_home_dir(), 'run_sate.py') if isinstance(args, str): arg_list = args.split() else: arg_list = args cmd = ['python', script_path] + arg_list _LOG.debug("Command:\n\t" + " ".join(cmd)) p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) o, e = p.communicate() exit_code = p.wait() if exit_code != rc: _LOG.error("exit code (%s) did not match %s" % (exit_code, rc)) _LOG.error("here is the stdout:\n%s" % o) _LOG.error("here is the stderr:\n%s" % e) self.assertEquals(exit_code, rc) if stdout != None: self.assertEquals(o, stdout) if stderr != None: self.assertEquals(e, stderr)
os.path.join(dirname, f) for f in filenames if not os.path.isdir(os.path.join(dirname, f)) ])) def extend_output_files(file_list, dirname, filenames): l = dirname.split(os.path.sep) target_list = l[l.index('sample-output'):] target = os.path.join(*target_list) file_list.append((target, [ os.path.join(dirname, f) for f in filenames if not os.path.isdir(os.path.join(dirname, f)) ])) bin_win_src = sate.sate_tools_dev_dir() bin_win_dest = sate.sate_tools_deploy_subpath() sate_src_root = sate.sate_home_dir() data_dir = os.path.join(sate_src_root, 'data') sample_output_dir = os.path.join(sate_src_root, 'sample-output') my_files = [] my_files.extend(find_data_files(bin_win_src, bin_win_dest, ['*'])) my_files.extend( find_data_files(os.path.join(bin_win_src, 'real_bin'), os.path.join(bin_win_dest, 'real_bin'), ['*'])) my_files.extend( find_data_files(os.path.join(sate_src_root, 'doc'), 'doc', ['*'])) os.path.walk(data_dir, extend_data_files, my_files) os.path.walk(sample_output_dir, extend_output_files, my_files) PY2EXE_OPTIONS = { "unbuffered": True, "optimize": 2,
[os.path.join(dirname, f) for f in filenames if not os.path.isdir( os.path.join(dirname, f))])) def extend_output_files(file_list, dirname, filenames): l = dirname.split(os.path.sep) target_list = l[l.index('sample-output'):] target = os.path.join(*target_list) file_list.append((target, [os.path.join(dirname, f) for f in filenames if not os.path.isdir( os.path.join(dirname, f))])) bin_win_src = sate.sate_tools_dev_dir() bin_win_dest = sate.sate_tools_deploy_subpath() sate_src_root = sate.sate_home_dir() data_dir = os.path.join(sate_src_root, 'data') sample_output_dir = os.path.join(sate_src_root, 'sample-output') my_files = [] my_files.extend( find_data_files( bin_win_src, bin_win_dest, ['*'] ) ) my_files.extend( find_data_files( os.path.join(bin_win_src, 'real_bin'), os.path.join(bin_win_dest, 'real_bin'), ['*'] ) ) my_files.extend( find_data_files( os.path.join(sate_src_root, 'doc'), 'doc', ['*']))