diff --git a/.github/workflows/merge_upstream_master.yml b/.github/workflows/merge_upstream_master.yml index d947beeaafa..4d010e90281 100644 --- a/.github/workflows/merge_upstream_master.yml +++ b/.github/workflows/merge_upstream_master.yml @@ -20,11 +20,16 @@ jobs: ref: ${{ env.PR_BRANCH }} fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Perform Merge run: | + chmod +x tools/bootstrap/python bash tools/hooks/install.sh bash tgui/bin/tgui --install-git-hooks - chmod +x tools/hooks/*.merge tgui/bin/tgui tools/bootstrap/python + chmod +x tools/hooks/*.merge tgui/bin/tgui git config user.name github-actions git config user.email github-actions@github.com git remote add upstream "https://github.com/${{ github.repository }}.git" diff --git a/tools/bootstrap/python b/tools/bootstrap/python index d5e031b8aaf..e679f2c7a6a 100755 --- a/tools/bootstrap/python +++ b/tools/bootstrap/python @@ -23,6 +23,7 @@ cd "$OldPWD" PythonVersion="$PYTHON_VERSION" PythonDir="$Cache/python-$PythonVersion" PythonExe="$PythonDir/python.exe" +PythonArg="" Log="$Cache/last-command.log" # If a portable Python for Windows is not present, search on $PATH. @@ -38,7 +39,8 @@ if [ "$(uname)" = "Linux" ] || [ ! -f "$PythonExe" ]; then elif command -v python >/dev/null 2>&1; then PythonExe=python elif command -v py >/dev/null 2>&1; then - PythonExe="py -3" + PythonExe="py" + PythonArg="-3" else echo if command -v apt-get >/dev/null 2>&1; then @@ -62,12 +64,17 @@ if [ "$(uname)" = "Linux" ] || [ ! -f "$PythonExe" ]; then PythonDir="$Cache/venv" if [ ! -d "$PythonDir" ]; then echo "Creating virtualenv..." - "$PythonExe" -m venv "$PythonDir" + "$PythonExe" $PythonArg -m venv "$PythonDir" fi if [ -f "$PythonDir/bin/python" ]; then PythonExe="$PythonDir/bin/python" + PythonArg="" elif [ -f "$PythonDir/scripts/python3.exe" ]; then PythonExe="$PythonDir/scripts/python3.exe"; + PythonArg="" + elif [ -f "$PythonDir/scripts/python.exe" ]; then + PythonExe="$PythonDir/scripts/python.exe"; + PythonArg="" else echo "bootstrap/python failed to find the python executable inside its virtualenv" exit 1 @@ -77,8 +84,9 @@ fi # Use pip to install our requirements if [ ! -f "$PythonDir/requirements.txt" ] || [ "$(b2sum < "$Sdk/requirements.txt")" != "$(b2sum < "$PythonDir/requirements.txt")" ]; then echo "Updating dependencies..." - "$PythonExe" -m pip install -U wheel - "$PythonExe" -m pip install -U pip -r "$Sdk/requirements.txt" + "$PythonExe" $PythonArg -m ensurepip || echo "ensurepip failed, continuing anyway..." + "$PythonExe" $PythonArg -m pip install -U wheel + "$PythonExe" $PythonArg -m pip install -U pip -r "$Sdk/requirements.txt" cp "$Sdk/requirements.txt" "$PythonDir/requirements.txt" echo "---" fi @@ -107,6 +115,11 @@ if ! command -v tee >/dev/null 2>&1; then } fi +if [ "$(uname -o)" = "Msys" ]; then + # replace /c/ with c:/ for Windows + Sdk=$(echo "$Sdk" | sed 's|^\(/.\)/|\1:/|') +fi + # Invoke python with all command-line arguments export PYTHONPATH="$Sdk$PATHSEP${PYTHONPATH:-}" mkdir -p "$Cache"