Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test and enable install phpy #18

Merged
merged 8 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
set -x
sh init.sh
bash install.sh --install-php 1 --install-phpy --install-python3 1
bash install.sh --install-php 1 --install-phpy --install-python3 1 --debug

macos:
runs-on: ${{ matrix.macos_version }}
Expand All @@ -70,7 +70,7 @@ jobs:
- name: install swoole
run: |
set -x
bash install.sh --install-php 1 --install-phpy --install-python3 1
bash install.sh --install-php 1 --install-phpy --install-python3 1 --debug

- name: show info
run: |
Expand Down
26 changes: 14 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -579,31 +579,33 @@ install_system_python3() {
}

check_python_exits() {
# shellcheck disable=SC2155
if test -x "$(which python)" -a -x "$(which python-config)"; then
# reference https://semver.org/
local PYTON3_MAJOR="$(python -V | awk '{ print $2 }' | awk -F '.' '{ print $1 }')"
if [ "${PYTON3_MAJOR}" == "3" ]; then
mkdir -p /tmp/python3/bin/
ln -s "$(which python)" /tmp/python3/bin/python3
ln -s "$(which python-config)" /tmp/python3/bin/python3-config
export PATH=/tmp/python3/bin/:$PATH
fi
fi
# shellcheck disable=SC2155
local PYTHON3="$(which python3)"
PYTHON3_CONFIG="$(which python3-config)"

if test -x "${PYTHON3}" -a -x "${PYTHON3_CONFIG}"; then
PYTHON3_DIR=$(python3-config --prefix)
PYTHON3_VERSION="$(python3 -V | awk '{ print $2 }')"
FORCE_INSTALL_PYTHON3=1
# 检测 python3 版本
# reference https://semver.org/
# shellcheck disable=SC2155
local PYTON3_MAJOR="$(python3 -V | awk '{ print $2 }' | awk -F '.' '{ print $1 }')"
# shellcheck disable=SC2155
local PYTON3_MINOR="$(python3 -V | awk '{ print $2 }' | awk -F '.' '{ print $2 }')"
if [ $(("${PYTON3_MAJOR}")) -ge 3 ]; then
if [ $(("${PYTON3_MAJOR}")) -eq 3 ] && [ $(("${PYTON3_MINOR}")) -lt 10 ]; then
echo "phpy no support python3 ${PYTHON3_VERSION} version ! "
exit 0
fi
fi

return 0
else
if test ${FORCE_INSTALL_PYTHON3} -eq 3; then
FORCE_INSTALL_PYTHON3=2
install_system_python3
check_python_exits
test $? -eq 0 && return 0
fi
echo 'no found python3 python3-config in $PATH '
echo 'please install python3 or link python3 python3-config '
Expand Down