File tree Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Expand file tree Collapse file tree 1 file changed +26
-4
lines changed Original file line number Diff line number Diff line change 1
1
STATE_FILE=" $DEVBOX_PROJECT_ROOT /.devbox/venv_check_completed"
2
+ echo $STATE_FILE
2
3
3
4
is_valid_venv () {
4
5
[ -f " $1 /bin/activate" ] && [ -f " $1 /bin/python" ]
@@ -10,10 +11,31 @@ is_devbox_python() {
10
11
echo " DEVBOX_PACKAGES_DIR is not set. Unable to check for Devbox Python."
11
12
return 1
12
13
fi
13
- local python_path=$( readlink " $1 /bin/python" )
14
- echo $python_path
15
- echo $DEVBOX_PACKAGES_DIR
16
- [[ $python_path == $DEVBOX_PACKAGES_DIR /bin/python* ]]
14
+ local python_path=" $1 /bin/python"
15
+ local link_target
16
+
17
+ while true ; do
18
+ if [ ! -L " $python_path " ]; then
19
+ echo $python_path
20
+ # Not a symlink, we're done
21
+ break
22
+ fi
23
+
24
+ link_target=$( readlink " $python_path " )
25
+ echo " Checking symlink: $link_target "
26
+
27
+ if [[ " $link_target " == /* ]]; then
28
+ # Absolute path, we're done
29
+ python_path=" $link_target "
30
+ break
31
+ elif [[ " $link_target " == python* ]] || [[ " $link_target " == ./* ]] || [[ " $link_target " == ../* ]]; then
32
+ # Relative path or python symlink, continue resolving
33
+ python_path=$( dirname " $python_path " ) /" $link_target "
34
+ else
35
+ # Unexpected format, stop here
36
+ break
37
+ fi
38
+ done
17
39
}
18
40
19
41
# Function to check Python version
You can’t perform that action at this time.
0 commit comments