Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mhpfiles
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Travis Seymour
mhpfiles
Commits
cfd0a797
Commit
cfd0a797
authored
3 months ago
by
Travis Seymour
Browse files
Options
Downloads
Patches
Plain Diff
alt approach to deciding if installs worked
parent
29ba6064
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tool_install.py
+18
-10
18 additions, 10 deletions
tool_install.py
with
18 additions
and
10 deletions
tool_install.py
+
18
−
10
View file @
cfd0a797
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment