-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate.fish
More file actions
47 lines (40 loc) · 1.15 KB
/
activate.fish
File metadata and controls
47 lines (40 loc) · 1.15 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
#
# Activate Python-NoAdmin environment for Fish shell.
#
# Usage: source ./scripts/activate.fish
#
set -l INSTALL_DIR "$HOME/.python-nonadmin"
set -l BIN_DIR "$INSTALL_DIR/bin"
# Check if installed
if not test -d $INSTALL_DIR
echo "[ERROR] Python-NoAdmin not installed at: $INSTALL_DIR"
echo "Run bootstrap-unix.sh first."
return 1
end
# Store original PATH for deactivation
if not set -q _PYTHON_NONADMIN_OLD_PATH
set -gx _PYTHON_NONADMIN_OLD_PATH $PATH
end
# Add to PATH
set -gx PATH $BIN_DIR $PATH
# Set marker for compatibility
set -gx PYTHON_NONADMIN_ACTIVE 1
# Define deactivate function
function deactivate_python_nonadmin
if set -q _PYTHON_NONADMIN_OLD_PATH
set -gx PATH $_PYTHON_NONADMIN_OLD_PATH
set -e _PYTHON_NONADMIN_OLD_PATH
end
set -e PYTHON_NONADMIN_ACTIVE
functions -e deactivate_python_nonadmin
echo "[INFO] Python-NoAdmin deactivated"
end
# Confirmation
set PYTHON_VERSION (eval $BIN_DIR/python3 --version 2>&1)
echo ""
echo "[SUCCESS] Python-NoAdmin activated"
echo " Python: $PYTHON_VERSION"
echo " Location: $INSTALL_DIR"
echo ""
echo " To deactivate: deactivate_python_nonadmin"
echo ""