Skip to content
Snippets Groups Projects
Commit a9214974 authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Script generation: added second to time string conversion, fixed setup info.

parent af2a9c4e
No related branches found
No related tags found
No related merge requests found
......@@ -195,6 +195,15 @@ class ExpConfig(ConfigObj):
result = ''
return result
def sec2time(seconds):
'''Create time string (HH:MM:SS) from second of day'''
seconds = int(seconds)
if seconds >= 86400:
raise ValueError("invalid second of day '{0}'".format(seconds))
minutes, s = divmod(seconds, 60)
h, m = divmod(minutes, 60)
return "{0:02}:{1:02}:{2:02}".format(h, m, s)
def split_date(value):
'''Re-format datetime string to list for use in namelists'''
match = re.match(r'^0*(\d+)-0*(\d+)-0*(\d+)'
......@@ -244,6 +253,10 @@ class ExpConfig(ConfigObj):
if match:
return split_date(match.group(1))
match = re.match(r'^sec2time\((.*)\)$', value, re.S)
if match:
return sec2time(match.group(1))
match = re.match(r'^read\((.*)\)$', value, re.S)
if match:
return read_value(match.group(1))
......
......@@ -15,8 +15,5 @@ setup(
scripts = ['mkexp', 'getexp', 'rmexp', 'diffexp', 'diffpath'],
platforms = ['Posix'],
license = 'LICENSE.txt',
data_files = [('share/doc/'+name+'-'+version+'/examples',
['examples/'+example+'.config'
for example in ['reference', 'old_input_data', 'mean_values']])],
requires = ['Jinja2(>= 2.6)']
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment