2929 - name : Check for existing Python 2.7
3030 id : check-python
3131 run : |
32- if command -v python2.7 &> /dev/null; then
32+ if command -v python2.7 &> /dev/null && python2.7 --version 2>&1 | grep -q "2.7" ; then
3333 echo "python_exists=true" >> $GITHUB_OUTPUT
3434 echo "✅ Python 2.7 already installed in system"
3535 else
4343 id : cache-python27
4444 with :
4545 path : /tmp/python-2.7.18
46- key : python-2.7.18-${{ runner.os }}-v3
46+ key : python-2.7.18-${{ runner.os }}-v4
4747 restore-keys : |
4848 python-2.7.18-${{ runner.os }}-
4949
@@ -61,28 +61,40 @@ jobs:
6161 cd ..
6262 rm -rf Python-2.7.18*
6363
64- - name : Setup Python from cache
64+ - name : Install Python to system from cache
6565 if : steps.check-python.outputs.python_exists == 'false' && steps.cache-python27.outputs.cache-hit == 'true'
6666 run : |
67- echo "Using cached Python 2.7.18"
67+ echo "Installing cached Python 2.7.18 to system..."
68+ sudo cp -r /tmp/python-2.7.18/* /usr/local/ || true
69+ # 确保二进制文件有执行权限
70+ sudo chmod +x /usr/local/bin/python2.7 /usr/local/bin/python2 || true
6871
69- - name : Install Python to system (if built from source)
72+ - name : Install Python to system from source
7073 if : steps.check-python.outputs.python_exists == 'false' && steps.cache-python27.outputs.cache-hit != 'true'
7174 run : |
72- echo "Installing Python 2.7.18 to system..."
75+ echo "Installing built Python 2.7.18 to system..."
7376 sudo cp -r /tmp/python-2.7.18/* /usr/local/
74- sudo ln -sf /usr/local/bin/python2.7 /usr/local/bin/python2
77+ # 确保二进制文件有执行权限
78+ sudo chmod +x /usr/local/bin/python2.7 /usr/local/bin/python2
79+
80+ - name : Create Python 2 symlinks
81+ if : steps.check-python.outputs.python_exists == 'false'
82+ run : |
83+ echo "Creating Python 2 symlinks..."
84+ sudo ln -sf /usr/local/bin/python2.7 /usr/local/bin/python2 || true
85+ sudo ln -sf /usr/local/bin/python2.7 /usr/bin/python2.7 || true
86+ sudo ln -sf /usr/local/bin/python2 /usr/bin/python2 || true
7587
7688 - name : Final Python verification
7789 run : |
78- echo "Final Python verification: "
79- which python2.7 && python2.7 --version || echo "python2.7 not in PATH"
80- which python2 && python2 --version || echo "python2 not in PATH "
81- # 如果系统没有,使用我们安装的
82- if ! command -v python2.7 &> /dev/null; then
83- echo "Adding /usr/local/bin to PATH "
84- echo "/usr/local/bin" >> $GITHUB_PATH
85- fi
90+ echo "=== Final Python Verification === "
91+ echo "PATH: $ PATH"
92+ echo " which python2.7: $(which python2.7 2>/dev/null || echo ' not found') "
93+ echo "which python2: $(which python2 2>/dev/null || echo 'not found')"
94+ python2.7 --version || echo " python2.7 --version failed"
95+ python2 --version || echo "python2 --version failed "
96+ echo "Python 2.7 location:"
97+ find /usr -name "python2.7" -type f 2>/dev/null | head -5 || echo "No python2.7 found in /usr"
8698
8799 - name : Clone kernel source and setup KernelSU
88100 run : |
0 commit comments