-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·52 lines (44 loc) · 1.33 KB
/
Copy pathinstall.py
File metadata and controls
executable file
·52 lines (44 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
"""
Installation script for the Gene Set Enrichment Pipeline.
Supports both uv and pip as dependency managers.
"""
import os
import subprocess
import sys
from pathlib import Path
def check_uv_installed():
"""Check if uv is installed."""
try:
subprocess.run(["uv", "--version"], capture_output=True, check=True)
return True
except (subprocess.CalledProcessError, FileNotFoundError):
return False
def install_with_uv(dev=False):
"""Install dependencies using uv."""
print("Installing with uv...")
cmd = ["uv", "pip", "install", "-e", "."]
if dev:
cmd.append(".[dev]")
subprocess.run(cmd, check=True)
def install_with_pip(dev=False):
"""Install dependencies using pip."""
print("Installing with pip...")
cmd = [sys.executable, "-m", "pip", "install", "-e", "."]
if dev:
cmd.append(".[dev]")
subprocess.run(cmd, check=True)
def main():
"""Main installation function."""
dev = "--dev" in sys.argv
use_uv = "--uv" in sys.argv
use_pip = "--pip" in sys.argv
if use_uv and use_pip:
print("Error: Cannot use both --uv and --pip flags")
sys.exit(1)
if use_uv or (not use_pip and check_uv_installed()):
install_with_uv(dev)
else:
install_with_pip(dev)
if __name__ == "__main__":
main()