Skip to content

Commit

Permalink
[TASK] v1.0.0-dev Add action '-T version'
Browse files Browse the repository at this point in the history
  • Loading branch information
marble committed Aug 30, 2017
1 parent e1d206b commit 4e454e2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
5 changes: 3 additions & 2 deletions 10-Toolchain-actions/run_02-Show-help-and-exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ def params_get(name, default=None):
Toolchain options:
-T clean Let the toolchain delete prior builds, then exit.
-T help Let the toolchain show this help, then exit.
-T unlock Let the toolchain remove existing locks, then exit
-T help Show toolchain help and e exit.
-T unlock Remove possible lock and exit.
-T version Show toolchain version and exit.
-c makedir PATH/TO/MAKEDIR Required! The path to the 'make' folder.
-c rebuild_needed 1 Force rebuild regardless of checksum
Expand Down
57 changes: 29 additions & 28 deletions 10-Toolchain-actions/run_03-Run-action-and-exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import tct
import sys

VERSION = '1.0.0-dev'

params = tct.readjson(sys.argv[1])
binabspath = sys.argv[2]
facts = tct.readjson(params['factsfile'])
Expand Down Expand Up @@ -167,37 +169,36 @@ def execute_cmdlist(cmdlist):
if one is not None:
exitcode_temp, cmd, out, err = execute_cmdlist(['ps', str(one)])


if exitcode == CONTINUE:
import shutil

for action in toolchain_actions:

if action == 'help':
'Should not occur'

elif action == 'unlock':
for top, dirs, files in os.walk(toolchain_temp_home):
dirs[:] = [] # stop recursion
for fname in files:
if fname == lockfile_name:
lockfile = os.path.join(top, fname)
os.remove(lockfile)
lockfiles_removed.append(lockfile)
exitcode = 90
break

elif action == 'clean':
for top, dirs, files in os.walk(toolchain_temp_home):
dirs.sort()
for adir in dirs:
fpath = os.path.join(top, adir)
if not run_id in adir:
if os.path.isdir(fpath):
shutil.rmtree(fpath)
dirs[:] = [] # stop recursion
exitcode = 90
break
if 'help' in toolchain_actions and exitcode == CONTINUE:
'Should not occur'

if 'version' in toolchain_actions and exitcode == CONTINUE:
print(VERSION)
exitcode = 90

if 'unlock' in toolchain_actions and exitcode == CONTINUE:
for top, dirs, files in os.walk(toolchain_temp_home):
dirs[:] = [] # stop recursion
for fname in files:
if fname == lockfile_name:
lockfile = os.path.join(top, fname)
os.remove(lockfile)
lockfiles_removed.append(lockfile)
exitcode = 90

if 'clean' in toolchain_actions and exitcode == CONTINUE:
for top, dirs, files in os.walk(toolchain_temp_home):
dirs.sort()
for adir in dirs:
fpath = os.path.join(top, adir)
if not run_id in adir:
if os.path.isdir(fpath):
shutil.rmtree(fpath)
dirs[:] = [] # stop recursion
exitcode = 90


# ==================================================
Expand Down

0 comments on commit 4e454e2

Please sign in to comment.