From 2913a5c89e89e0c448f01b2e9972c87107e25297 Mon Sep 17 00:00:00 2001 From: Niccolo Raspa Date: Thu, 13 Jun 2024 10:52:37 +0200 Subject: [PATCH] evert "Fix bug when binary is not present" This reverts commit 93dfd86d74c3d42c1b0cfe9af33673ddb3233680. --- i.py | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/i.py b/i.py index c425cd1..60114c1 100644 --- a/i.py +++ b/i.py @@ -651,24 +651,21 @@ def download_binary(network): if not args.overwrite: # Check if osmosisd is already installed - if os.path.exists(binary_path): - try: - subprocess.run([binary_path, "version"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - print("osmosisd is already installed at " + bcolors.OKGREEN + f"{binary_path}" + bcolors.ENDC) - while True: - choice = input("Do you want to skip the download or overwrite the binary? (skip/overwrite): ").strip().lower() - if choice == "skip": - print("Skipping download.") - return - elif choice == "overwrite": - print("Proceeding with overwrite.") - break - else: - print("Invalid input. Please enter 'skip' or 'overwrite'.") - except subprocess.CalledProcessError: - print("osmosisd is not installed. Proceeding with download.") - else: - print(f"Binary not found at {binary_path}. Proceeding with download.") + try: + subprocess.run([binary_path, "version"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + print("osmosisd is already installed at " + bcolors.OKGREEN + f"{binary_path}" + bcolors.ENDC) + while True: + choice = input("Do you want to skip the download or overwrite the binary? (skip/overwrite): ").strip().lower() + if choice == "skip": + print("Skipping download.") + return + elif choice == "overwrite": + print("Proceeding with overwrite.") + break + else: + print("Invalid input. Please enter 'skip' or 'overwrite'.") + except subprocess.CalledProcessError: + print("osmosisd is not installed. Proceeding with download.") operating_system = platform.system().lower() architecture = platform.machine() @@ -694,7 +691,7 @@ def download_binary(network): sys.exit(0) try: - print("Downloading " + bcolors.PURPLE + "osmosisd..." + bcolors.ENDC, end="\n\n") + print("Downloading " + bcolors.PURPLE + "osmosisd" + bcolors.ENDC, end="\n\n") print("from " + bcolors.OKGREEN + f"{binary_url}" + bcolors.ENDC, end=" ") print("to " + bcolors.OKGREEN + f"{binary_path}" + bcolors.ENDC) print() @@ -711,7 +708,7 @@ def download_binary(network): subprocess.run(["mv", "/tmp/osmosisd", binary_path], check=True) # Test binary - subprocess.run([binary_path, "version"], check=True) + subprocess.run(["osmosisd", "version"], check=True) print("Binary downloaded successfully.")