Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
  • Loading branch information
jdsika committed Nov 6, 2023
1 parent ea8e3e0 commit da18324
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
37 changes: 26 additions & 11 deletions src/launch_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,35 @@


def python_version_ok(args=None):
print("Checking python version ...\n")
major = sys.version_info.major
minor = sys.version_info.minor
if not (
sys.version_info.major >= PYTHON_MAJOR
and sys.version_info.minor >= PYTHON_MINOR
major >= PYTHON_MAJOR
and minor >= PYTHON_MINOR
):
raise Exception(
"Must be using Python {}.{} or later but it is {}.{}".format(
"... must be using Python {}.{} or later but it installed is {}.{}. Please upgrade!\n".format(
PYTHON_MAJOR,
PYTHON_MINOR,
sys.version_info.major,
sys.version_info.minor,
major,
minor,
)
)
else:
print(
"... installed Python version {}.{} is greater then minimum required version {}.{}. OK!\n".format(
major,
minor,
PYTHON_MAJOR,
PYTHON_MINOR,
)
)
return True


def print_banner(args, script_name):
print(LINER, flush=True)
with open("./banner.txt", "rt") as file:
print(file.read())
print(LINER, flush=True)
Expand Down Expand Up @@ -62,10 +74,11 @@ def renamed_fee_ini(args=None):
return True


def new_protocol_live(args=None):
def new_protocol_not_live(args=None):
print("Checking ...\n")
today = date.today()
print(("Current date: {}").format(today))
print(("New protocol date: {}").format(NEW_PROTOCOL_DATE))
print(("... current date: {}\n").format(today))
print(("... new protocol date: {}\n").format(NEW_PROTOCOL_DATE))
if today >= NEW_PROTOCOL_DATE:
print(
(
Expand All @@ -77,8 +90,10 @@ def new_protocol_live(args=None):
print("Do you want to continue using this branch? (y/N)")
value = input().lower()
if not value or value == "n":
return True
return False
return False
else:
print(("... protocol {} not live yet. OK!").format(NEW_PROTOCOL_NAME))
return True


def in_venv():
Expand Down Expand Up @@ -145,7 +160,7 @@ def requirements_installed(requirement_path=REQUIREMENTS_FILE_PATH):
print("Requirements successfully installed!\n")
return True
else:
print("... all dependencies available!\n")
print("... all dependencies available. OK!\n")
return True
except (OSError, IOError) as e:
print(
Expand Down
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from launch_common import (
new_protocol_live,
new_protocol_not_live,
requirements_installed,
renamed_fee_ini,
python_version_ok,
Expand All @@ -14,7 +14,7 @@ def start_application(args=None):
python_version_ok()
and requirements_installed()
and renamed_fee_ini()
and not new_protocol_live()
and new_protocol_not_live()
)

if ready:
Expand Down

0 comments on commit da18324

Please sign in to comment.