aboutsummaryrefslogtreecommitdiff
path: root/steuermann
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2016-07-03 19:51:45 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2016-07-03 19:51:45 -0400
commite0962f13a189e32dd0ff7f5837cc0be1150cf150 (patch)
treefa3baf28264ad03f3ac4bd4fcb757ff2ce0512e1 /steuermann
parent3ceefc1fef740c4d1d9afd7c42e5bc7189b7032b (diff)
downloadsteuermann-e0962f13a189e32dd0ff7f5837cc0be1150cf150.tar.gz
Python 3k portability issues; implement more pleasent exit sequence from interactive mode
Diffstat (limited to 'steuermann')
-rw-r--r--steuermann/nodes.py2
-rw-r--r--steuermann/report.py6
-rw-r--r--steuermann/run.py10
-rw-r--r--steuermann/run_all.py26
-rw-r--r--steuermann/specfile.exy2
5 files changed, 31 insertions, 15 deletions
diff --git a/steuermann/nodes.py b/steuermann/nodes.py
index 2d93a72..aaf42d6 100644
--- a/steuermann/nodes.py
+++ b/steuermann/nodes.py
@@ -327,7 +327,7 @@ def compute_depths(nodes) :
#####
-import specfile
+from . import specfile
current_file_name = None
diff --git a/steuermann/report.py b/steuermann/report.py
index ab4796b..afdf650 100644
--- a/steuermann/report.py
+++ b/steuermann/report.py
@@ -7,7 +7,11 @@ import time
import sys
import pandokia.text_table as text_table
import pandokia.common
-import StringIO
+
+try:
+ from io import StringIO
+except ImportError:
+ import StringIO
# maybe the output is html 3.2 - in any case, it is way simpler than
# more recent standards.
diff --git a/steuermann/run.py b/steuermann/run.py
index adbc40d..48386ea 100644
--- a/steuermann/run.py
+++ b/steuermann/run.py
@@ -29,9 +29,15 @@ import os.path
import traceback
import sys
import errno
-import ConfigParser
import re
-import nodes
+
+from . import nodes
+
+try:
+ import configparser as ConfigParser
+except ImportError:
+ import ConfigParser
+
def config_yes_no(d,which) :
if not which in d :
diff --git a/steuermann/run_all.py b/steuermann/run_all.py
index 6ef8b82..d4c3f3d 100644
--- a/steuermann/run_all.py
+++ b/steuermann/run_all.py
@@ -7,25 +7,27 @@ import time
import sys
import os.path
import datetime
-
-import run
-import report
-import nodes
import getpass
-import steuermann.config
-
import pandokia.helpers.easyargs as easyargs
import pandokia.text_table as text_table
+from . import config
+from . import run
+from . import report
+from . import nodes
from . import allowed_flags
-try :
+try:
import readline
except ImportError :
readline = None
+try:
+ input = raw_input
+except NameError:
+ raw_input = input
# global dicts for storing common resource info
# populated in main() from hosts INI file
@@ -108,7 +110,7 @@ def main() :
# parse common resources from hosts INI file
get_common_resources(hosts_ini)
- db = steuermann.config.open_db()
+ db = config.open_db()
if all :
run_all(xnodes, run_name, hosts_ini, db)
@@ -273,6 +275,10 @@ def run_interactive( xnodes, run_name, hosts_ini, db) :
try :
l = raw_input("smc>")
except EOFError :
+ print('')
+ break
+ except KeyboardInterrupt:
+ print('')
break
l = l.strip()
@@ -613,7 +619,7 @@ def run_step( runner, xnodes, run_name, db ) :
workdir = args['workdir']
hostname = args['hostname']
src = os.path.join(workdir, run_name, who_exited[0])
- dst = os.path.join(steuermann.config.host_logs, run_name, who_exited[0])
+ dst = os.path.join(config.host_logs, run_name, who_exited[0])
try:
os.system('mkdir -p %s' %os.path.dirname(dst))
@@ -674,7 +680,7 @@ def info_callback_depth( db, run, tablename, host, cmd ) :
#####
def make_log_file_name( run_name, table, host, cmd ) :
- return '%s/run/%s/%s/%s/%s.log'%(steuermann.config.logdir, run_name, table, host, cmd)
+ return '%s/run/%s/%s/%s/%s.log'%(config.logdir, run_name, table, host, cmd)
if __name__ == '__main__' :
diff --git a/steuermann/specfile.exy b/steuermann/specfile.exy
index 4c65a07..d95b017 100644
--- a/steuermann/specfile.exy
+++ b/steuermann/specfile.exy
@@ -2,7 +2,7 @@
# Parse a Steuermann Spec file
#
# This is an exyapps grammer in specfile.exy
-import nodes
+from . import nodes
%%
parser specfile: