Skip to content

Commit

Permalink
evert "Fix bug when binary is not present"
Browse files Browse the repository at this point in the history
This reverts commit 93dfd86.
  • Loading branch information
niccoloraspa committed Jun 13, 2024
1 parent 93dfd86 commit 2913a5c
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions i.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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.")

Expand Down

0 comments on commit 2913a5c

Please sign in to comment.