def get_invoke_run_pasta_command(): """Used by GUI's this tries to return the python invocation for the run program or script. """ if pasta.pasta_is_frozen(): if platform.system() == 'Windows': return ['run_pasta.exe'] elif platform.system() == 'Darwin': return [filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path(os.path.join(pasta.pasta_home_dir(), 'run_pasta.py'))] else: raise OSError('PASTA is not frozen for %s' % platform.system()) else: return [filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path(os.path.join(pasta.pasta_home_dir(), 'run_pasta.py'))]
def get_invoke_run_pasta_command(): """Used by GUI's this tries to return the python invocation for the run program or script. """ if pasta.pasta_is_frozen(): if platform.system() == 'Windows': return ['run_pasta.exe'] elif platform.system() == 'Darwin': return [ filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path( os.path.join(pasta.pasta_home_dir(), 'run_pasta.py')) ] else: raise OSError('PASTA is not frozen for %s' % platform.system()) else: return [ filemgr.quoted_file_path(sys.executable), filemgr.quoted_file_path( os.path.join(pasta.pasta_home_dir(), 'run_pasta.py')) ]
def _exe_run_sate(self, args, stdout=None, stderr=None, rc=0): script_path = os.path.join(pasta.pasta_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.assertEqual(exit_code, rc) if stdout != None: self.assertEqual(o, stdout) if stderr != None: self.assertEqual(e, stderr)
def _exe_run_sate(self, args, stdout=None, stderr=None, rc=0): script_path = os.path.join(pasta.pasta_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 = pasta.pasta_tools_dev_dir() bin_win_dest = pasta.pasta_tools_deploy_subpath() pasta_src_root = pasta.pasta_home_dir() data_dir = os.path.join(pasta_src_root, 'data') sample_output_dir = os.path.join(pasta_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(pasta_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 = pasta.pasta_tools_dev_dir() bin_win_dest = pasta.pasta_tools_deploy_subpath() pasta_src_root = pasta.pasta_home_dir() data_dir = os.path.join(pasta_src_root, 'data') sample_output_dir = os.path.join(pasta_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(pasta_src_root, 'doc'), 'doc', ['*']))
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Jiaye Yu and Mark Holder, University of Kansas if __name__ == "__main__": import os import sys import pasta if pasta.pasta_is_frozen() and '-i' not in sys.argv: exec( open(os.path.join(pasta.pasta_home_dir(), 'run_pasta_gui.py')).read()) sys.exit(1) from pasta.mainpasta import pasta_main from pasta import MESSENGER sys.setrecursionlimit(100000) _PASTA_DEBUG = os.environ.get('PASTA_DEBUG') _DEVELOPER = _PASTA_DEBUG and _PASTA_DEBUG != '0' if not _DEVELOPER: _PASTA_DEVELOPER = os.environ.get('PASTA_DEVELOPER') _DEVELOPER = _PASTA_DEVELOPER and _PASTA_DEVELOPER != '0' try: rc, temp_dir, temp_fs = pasta_main() if not rc: raise ValueError("Unknown PASTA execution error")