-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·39 lines (32 loc) · 1003 Bytes
/
setup.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1003 Bytes
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
#!/bin/bash
set -e
# Find setup.cfg in the current directory
SETUP_CFG="./setup.cfg"
REQ_FILE="./requirements.txt"
if [[ ! -f "$SETUP_CFG" ]]; then
echo "❌ setup.cfg not found in current directory."
exit 1
fi
# Extract the Python executable path from setup.cfg
PYTHON_EXEC=$(awk '
/^\[build_scripts\]/ { in_section=1; next }
/^\[/ { in_section=0 }
in_section && /^executable *=/ {
sub(/^executable *= */, "", $0)
print $0
exit
}
' "$SETUP_CFG")
if [[ -z "$PYTHON_EXEC" || ! -x "$PYTHON_EXEC" ]]; then
echo "❌ Invalid or missing Python executable in setup.cfg: '$PYTHON_EXEC'"
exit 1
fi
if [[ ! -f "$REQ_FILE" ]]; then
echo "⚠️ requirements.txt not found. Nothing to install."
exit 0
fi
# Install dependencies using the specified Python executable
echo "📦 Installing dependencies with: $PYTHON_EXEC"
"$PYTHON_EXEC" -m pip install --upgrade pip
"$PYTHON_EXEC" -m pip install -r "$REQ_FILE"
echo "✅ Installation complete."