Skip to content
Snippets Groups Projects
Commit cfd0a797 authored by Travis Seymour's avatar Travis Seymour
Browse files

alt approach to deciding if installs worked

parent 29ba6064
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,14 @@ def get_python_3_9_path():
sys.exit(1)
def is_tool_installed(tool_name):
"""Check if a tool is listed in the output of 'uv tool list'."""
uv_tool_list = run_command(["uv", "tool", "list"])
if uv_tool_list and tool_name in uv_tool_list:
return True
return False
def main():
ensure_git_installed()
......@@ -82,15 +90,14 @@ def main():
else:
python_path = get_python_3_10_path()
# Step 1: Check if EPICpy is installed and uninstall it if necessary
uv_tool_list = run_command(["uv", "tool", "list"])
if uv_tool_list and "EPICpy" in uv_tool_list:
# Step 1: Uninstall EPICpy if it is already installed
if is_tool_installed("EPICpy"):
print("EPICpy is already installed. Uninstalling...")
run_command(["uv", "tool", "uninstall", "EPICpy"])
# Step 2: Install EPICpy using the determined Python path
print(f"Installing EPICpy with Python at {python_path}...")
install_output = run_command(
run_command(
[
"uv",
"tool",
......@@ -101,21 +108,21 @@ def main():
]
)
if install_output and "Installed 1 executable: EPICpy" in install_output:
# Verify EPICpy installation
if is_tool_installed("EPICpy"):
print("EPICpy installed successfully! You can run it from the terminal like this: EPICpy")
else:
print("Failed to install EPICpy. Please check the error above and try again.", file=sys.stderr)
sys.exit(1)
# Step 3: Check if epiccoder is installed and uninstall it if necessary
uv_tool_list = run_command(["uv", "tool", "list"])
if uv_tool_list and "epiccoder" in uv_tool_list:
# Step 3: Uninstall epiccoder if it is already installed
if is_tool_installed("epiccoder"):
print("epiccoder is already installed. Uninstalling...")
run_command(["uv", "tool", "uninstall", "epiccoder"])
# Step 4: Install epiccoder
print("Installing epiccoder...")
epiccoder_output = run_command(
run_command(
[
"uv",
"tool",
......@@ -124,7 +131,8 @@ def main():
]
)
if epiccoder_output and "Installed 1 executable: epiccoder" in epiccoder_output:
# Verify epiccoder installation
if is_tool_installed("epiccoder"):
print("epiccoder installed successfully! You can run it from the terminal like this: epiccoder")
else:
print("Failed to install epiccoder. Please check the error above and try again.", file=sys.stderr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment