scripts: sd_fusing: Check the minimum required Python version
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 14 Oct 2024 23:59:48 +0000 (08:59 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 4 Dec 2024 11:59:27 +0000 (20:59 +0900)
"extend" of action was added since python3.8.
If python version is lower than 3.8, it will be occurred the error like below.

Traceback (most recent call last):
  File "./scripts/tizen/sd_fusing.py", line 1375, in <module>
    help="binary to flash, may be used multiple times")
  File "/usr/local/lib/python3.7/argparse.py", line 1358, in add_argument
    raise ValueError('unknown action "%s"' % (action_class,))
ValueError: unknown action "extend"

Refer to Python Doc:
3.7 - https://docs.python.org/3.7/library/argparse.html#action
3.8 - https://docs.python.org/3.8/library/argparse.html#action

Change-Id: I8d9deafcddbe67f80adc310d01f22891a2d802ae
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
sd_fusing.py

index 4505bbbd9405245f58231c12828bb5965d771fcf..4d0dc0caf965afe58ebccf345fc99d5cd4d2cbd9 100755 (executable)
@@ -15,7 +15,7 @@ import sys
 import tarfile
 import tempfile
 
-__version__ = "1.1.12"
+__version__ = "1.1.13"
 
 Format = False
 Device = ""
@@ -1397,8 +1397,14 @@ def logging_notice(msg, *args, **kws):
     logging.root.notice(msg, *args, **kws)
 logging.notice = logging_notice
 
+def check_python_version():
+    required_min_ver=(3,8)
+    if sys.version_info[:2] < required_min_ver:
+        print("Minimum required Python version is 3.8")
+        sys.exit(1)
 
 if __name__ == '__main__':
+    check_python_version()
     parser = argparse.ArgumentParser(description="For {}, version {}".format(
         ", ".join([v.long_name for k,v in TARGETS.items()]),
         __version__