-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·73 lines (63 loc) · 1.98 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·73 lines (63 loc) · 1.98 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
set -euo pipefail
# Universal Dependency Resolver — One-command install
# Usage: bash <(curl -fsSL https://raw.githubusercontent.com/code-with-zeeshan/universal-dependency-resolver/main/install.sh)
APP="UDR (Universal Dependency Resolver)"
COLOR_CYAN="\033[0;36m"
COLOR_GREEN="\033[0;32m"
COLOR_YELLOW="\033[1;33m"
COLOR_RED="\033[0;31m"
COLOR_RESET="\033[0m"
info() { echo -e "${COLOR_CYAN}[INFO]${COLOR_RESET} $*"; }
ok() { echo -e "${COLOR_GREEN}[OK]${COLOR_RESET} $*"; }
warn() { echo -e "${COLOR_YELLOW}[WARN]${COLOR_RESET} $*"; }
fail() { echo -e "${COLOR_RED}[FAIL]${COLOR_RESET} $*"; exit 1; }
get_version() {
if command -v udr &>/dev/null; then
udr --version 2>/dev/null | grep -oP '\d+\.\d+\.\d+' || echo "unknown"
elif [[ -f pyproject.toml ]]; then
grep -m1 '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/' || echo "unknown"
else
echo "unknown"
fi
}
install_from_source() {
VERSION=$(get_version)
info "Installing from source (v$VERSION)..."
python3 -m venv venv
source venv/bin/activate
pip install --quiet -e "."
ok "Backend installed"
echo
ok "$APP v$VERSION installed!"
echo
echo "Usage:"
echo " source venv/bin/activate"
echo " udr resolve numpy pandas --json"
echo " udr check --deps requirements.txt"
echo " udr --help"
}
main() {
VERSION=$(get_version)
echo
echo "========================================"
echo " $APP v$VERSION"
echo " Universal cross-ecosystem dependency resolver"
echo "========================================"
echo
if ! command -v python3 &>/dev/null; then
fail "Python 3.11+ is required. Install it first: https://www.python.org/downloads/"
fi
# Quick install via pip
if [[ ! -f pyproject.toml ]]; then
info "Installing from PyPI..."
pip install ud-resolver
VERSION=$(get_version)
ok "$APP v$VERSION installed!"
ok "Run 'udr --help' to get started."
exit 0
fi
# Source install for contributors
install_from_source
}
main "$@"