Skip to content

Commit 444ff33

Browse files
committed
Update Python3 from 3.10 to 3.11 in CI
Also, refactor CI configs to only specify the Python 3 and Perl versions in one place, so we don't have to multiple lines in the config file. Additionally, add checks to make sure the Homebrew Python 3 version matches the configured one, so we will have a failed build and be notified this way instead of silently building against an old version of Python in CI, which would still work as GitHub CI has older versions of Python installed. Note that if vim/vim#12032 is merged, this will be less painful in the future as stable ABI should mean we don't have to care as much about the exact Python version.
1 parent 00889b1 commit 444ff33

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

.github/workflows/ci-macvim.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ env:
2020

2121
CC: clang
2222

23-
VERSIONER_PERL_VERSION: '5.30'
24-
VERSIONER_PYTHON_VERSION: '2.7'
23+
VERSIONER_PERL_VERSION: '5.30' # macOS default Perl installation uses this to determine which one to use
24+
PYTHON3_VERSION: '3.11' # Make sure to keep src/MacVim/vimrc synced with the Python version here for the Python DLL detection logic.
25+
2526
vi_cv_path_python: /usr/local/bin/python
2627
vi_cv_path_python3: /usr/local/bin/python3
2728
vi_cv_path_plain_lua: /usr/local/bin/lua
2829
vi_cv_path_ruby: /usr/local/opt/ruby/bin/ruby
29-
vi_cv_dll_name_perl: /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/libperl.dylib
30+
vi_cv_dll_name_perl: /System/Library/Perl/%s/darwin-thread-multi-2level/CORE/libperl.dylib
3031
vi_cv_dll_name_python: /usr/local/Frameworks/Python.framework/Versions/2.7/Python
31-
vi_cv_dll_name_python3: /usr/local/Frameworks/Python.framework/Versions/3.10/Python # Make sure to keep src/MacVim/vimrc synced with the Python version here for the Python DLL detection logic.
32-
vi_cv_dll_name_python3_arm64: /opt/homebrew/Frameworks/Python.framework/Versions/3.10/Python
32+
vi_cv_dll_name_python3: /usr/local/Frameworks/Python.framework/Versions/%s/Python
33+
vi_cv_dll_name_python3_arm64: /opt/homebrew/Frameworks/Python.framework/Versions/%s/Python
3334
vi_cv_dll_name_ruby: /usr/local/opt/ruby/lib/libruby.dylib
3435
vi_cv_dll_name_ruby_arm64: /opt/homebrew/opt/ruby/lib/libruby.dylib
3536
vi_cv_dll_name_lua_arm64: /opt/homebrew/lib/liblua.dylib
@@ -138,6 +139,23 @@ jobs:
138139
brew unlink perl
139140
fi
140141
142+
# With Perl and Python, we need to manually specify the version number for various reasons
143+
# (e.g. library paths include the version number). Because of that, check that the version
144+
# matches the expectation and fail if they don't, so we can go and fix it. Only do for
145+
# Python because a wrong Perl version would just fail the build later.
146+
if [[ "$(python3 --version)" != *"Python $PYTHON3_VERSION"* ]]; then
147+
printf "\n"
148+
echo "Wrong Python 3 version: $(python3 --version). Expected $PYTHON3_VERSION."
149+
printf "\n"
150+
echo "This likely happened because Homebrew was updated to point to a newer version of"
151+
echo "Python 3. Update PYTHON3_VERSION to fix this."
152+
exit -1
153+
fi
154+
155+
echo "vi_cv_dll_name_perl=$(printf $vi_cv_dll_name_perl $VERSIONER_PERL_VERSION)" >> $GITHUB_ENV
156+
echo "vi_cv_dll_name_python3=$(printf $vi_cv_dll_name_python3 $PYTHON3_VERSION)" >> $GITHUB_ENV
157+
echo "vi_cv_dll_name_python3_arm64=$(printf $vi_cv_dll_name_python3_arm64 $PYTHON3_VERSION)" >> $GITHUB_ENV
158+
141159
# All set up steps are done. Build and test MacVim below.
142160

143161
- name: Configure

src/MacVim/vimrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ endif
3232
" or an installation from python.org:
3333
if exists("&pythonthreedll") && exists("&pythonthreehome") &&
3434
\ !filereadable(&pythonthreedll)
35-
if filereadable("/opt/local/Library/Frameworks/Python.framework/Versions/3.10/Python")
36-
" MacPorts python 3.10
37-
set pythonthreedll=/opt/local/Library/Frameworks/Python.framework/Versions/3.10/Python
38-
elseif filereadable("/Library/Frameworks/Python.framework/Versions/3.10/Python")
35+
if filereadable("/opt/local/Library/Frameworks/Python.framework/Versions/3.11/Python")
36+
" MacPorts python
37+
set pythonthreedll=/opt/local/Library/Frameworks/Python.framework/Versions/3.11/Python
38+
elseif filereadable("/Library/Frameworks/Python.framework/Versions/3.11/Python")
3939
" https://www.python.org/downloads/mac-osx/
40-
set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.10/Python
40+
set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.11/Python
4141
endif
4242
endif
4343

0 commit comments

Comments
 (0)