-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_pasta.py
executable file
·63 lines (55 loc) · 2.46 KB
/
run_pasta.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /usr/bin/env python
"""Main script of PASTA in command-line mode - this simply invokes the main
function found in pasta/mainpasta.py
"""
# This file is part of PASTA which is forked from SATe
# PASTA like SATe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# 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
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")
if (temp_dir is not None) and (os.path.exists(temp_dir)):
MESSENGER.send_info("Note that temporary files from the run have not been deleted, they can be found in:\n '%s'\n" % temp_dir)
if sys.platform.lower().startswith('darwin') and ("'" not in temp_dir):
MESSENGER.send_info('''
If you cannot see this directory in the Finder application, you may want to use
the 'open' command executed from a Terminal. You can do this by launching the
/Applications/Utilities/Terminal program and then typing
open '%s'
followed by a return at the prompt. If the argument to the open command is a
directory, then it should open a Finder window in the directory (even if that
directory is hidden by default).
''' % temp_dir)
except Exception, x:
if _DEVELOPER:
raise
message = "PASTA is exiting because of an error:\n%s " % str(x)
try:
from pasta import MESSENGER
MESSENGER.send_error(message)
except:
sys.stderr.write(message)
sys.exit(1)