2022-03-08 19:24:36 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-07-27 18:57:36 +00:00
|
|
|
|
2021-04-12 19:25:34 +00:00
|
|
|
set -e
|
|
|
|
|
2023-02-13 20:52:17 +00:00
|
|
|
# Use a built-in standalone version of Python if available in a directory
|
|
|
|
# called python. This is used for Electron packaging. The standalone Python
|
|
|
|
# will have extra packages installed, and then be moved to a standard location
|
|
|
|
# (sandbox_venv3).
|
|
|
|
for possible_path in python/bin/python python/bin/python3 \
|
|
|
|
python/Scripts/python.exe python/python.exe; do
|
|
|
|
if [[ -e $possible_path ]]; then
|
|
|
|
echo "found $possible_path"
|
|
|
|
buildtools/prepare_python3.sh $possible_path python
|
|
|
|
# Make sure Python2 sandbox is not around.
|
|
|
|
rm -rf venv
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2022-01-07 17:06:04 +00:00
|
|
|
echo "Use Python3 if available and recent enough, otherwise Python2"
|
|
|
|
if python3 -c 'import sys; assert sys.version_info >= (3,9)' 2> /dev/null; then
|
|
|
|
# Default to python3 if recent enough.
|
2023-02-13 20:52:17 +00:00
|
|
|
buildtools/prepare_python3.sh python3
|
2022-01-07 17:06:04 +00:00
|
|
|
# Make sure python2 isn't around.
|
|
|
|
rm -rf venv
|
|
|
|
else
|
|
|
|
buildtools/prepare_python2.sh
|
|
|
|
# Make sure python3 isn't around.
|
|
|
|
rm -rf sandbox_venv3
|
2020-07-27 18:57:36 +00:00
|
|
|
fi
|