From 62145ff10215e25793e49d7a83d350d665946fce Mon Sep 17 00:00:00 2001 From: vanutp Date: Sun, 26 Dec 2021 12:59:36 +0300 Subject: [PATCH] feat(update): show when no updates are available --- tgpy/run_code/builtin_functions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tgpy/run_code/builtin_functions.py b/tgpy/run_code/builtin_functions.py index b08de7e..7e4f39c 100644 --- a/tgpy/run_code/builtin_functions.py +++ b/tgpy/run_code/builtin_functions.py @@ -45,6 +45,7 @@ def restart(msg: Optional[str] = 'Restarted successfully'): @save_function_to_variables def update(): + old_version = get_version() if installed_as_package(): update_args = [sys.executable, '-m', 'pip', 'install', '-U', 'tgpy'] try: @@ -53,7 +54,11 @@ def update(): run_cmd(update_args + ['--user']) else: run_cmd(['git', 'pull']) - restart(f'Updated successfully! Current version: {get_version()}') + new_version = get_version() + if old_version == new_version: + return 'Already up to date' + else: + restart(f'Updated successfully! Current version: {new_version}') class HooksObject: