auto_status_file: strip file extensions on prefix
When generating a default prefix value based on a program's name, strip any
file extensions (e.g. ".py", ".sh").
Change-Id: I0c4afd754cd1336cbef6d2ef658570d152cd263a
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/bin/auto_status_file.py b/bin/auto_status_file.py
index 0ec967c..3d3acc3 100755
--- a/bin/auto_status_file.py
+++ b/bin/auto_status_file.py
@@ -6,6 +6,7 @@
import sys
import subprocess
+import re
save_path_0 = sys.path[0]
del sys.path[0]
@@ -153,6 +154,10 @@
if status_file_name == "":
if prefix == "":
prefix = command_string.split(" ")[0]
+ # File extensions (e.g. ".sh", ".py", .etc), look clumsy in
+ # status file names.
+ extension_regex = "\\.[a-zA-Z0-9]{1,3}$"
+ prefix = re.sub(extension_regex, "", prefix)
set_pgm_arg(prefix)
status_file_name = prefix + "." + file_date_time_stamp() + ".status"
set_pgm_arg(status_file_name)