import re
from pprint import PrettyPrinter
+options={}
+
+def init_options(options_arg):
+ global options
+ options=options_arg
+
# how could this accept a list again ?
def header(message):
now=time.strftime("%H:%M:%S", time.localtime())
print ">",now,"--",message
PrettyPrinter(indent=8,depth=depth).pprint(spec)
+# quick & dirty - should probably use the parseroption object instead
+# and move to TestMain as well
+exclude_options_keys = [ 'ensure_value' , 'read_file', 'read_module' ]
+def show_options (message,options):
+ now=time.strftime("%H:%M:%S", time.localtime())
+ print ">",now,"--",message
+ for k in dir(options):
+ if k.find("_")==0: continue
+ if k in exclude_options_keys: continue
+ print " ",k,":",getattr(options,k)
+
def show_site_spec (site):
print '======== site',site['site_fields']['name']
for (k,v) in site.iteritems():
def system(command,background=False):
now=time.strftime("%H:%M:%S", time.localtime())
if background: command += " &"
- print "+",now,':',command
- return os.system("set -x; " + command)
+ if options.dry_run:
+ print 'dry_run:',command
+ return 0
+ else:
+ return os.system("set -x; " + command)
def match (string, pattern):
# tmp - there's probably much simpler