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

tests: fix edge case where non-default python is used, by skipping it #11005

Merged
merged 2 commits into from
Nov 15, 2022
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
8 changes: 7 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ jobs:
- uses: actions/checkout@v2
# Avoid picking up an older version of LLVM that does not work.
- run: brew update
# github actions overwrites brew's python. Force it to reassert itself, by running in a separate step.
- name: unbreak python in github actions
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might suffice to just do

brew install --force --overwrite python3

here.

# use python3 from homebrew because it is a valid framework, unlike the actions one:
# https://github.com/actions/setup-python/issues/58
- run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 python3 boost-python3 gtk-doc
- run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc
- run: |
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip
Expand Down
17 changes: 12 additions & 5 deletions test cases/python/2 extmodule/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ py.install_sources(blaster, subdir: 'pure')

py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false)
if py3_pkg_dep.found()
python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir')

# Check we can apply a version constraint
dependency('python3', version: '>=@0@'.format(py_dep.version()))
py3_dep_majver = py3_pkg_dep.version().split('.')
py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1]
message(f'got two pythons: pkg-config is @py3_dep_majver@, and module is', py.language_version())
if py3_dep_majver != py.language_version()
message('skipped python3 pkg-config test because the default python3 is different from Meson\'s')
else
python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir')

# Check we can apply a version constraint
dependency('python3', version: '>=@0@'.format(py_dep.version()))
endif
else
message('Skipped python3 pkg-config test')
message('Skipped python3 pkg-config test because it was not found')
endif
6 changes: 6 additions & 0 deletions test cases/python3/3 cython/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ py3_dep = dependency('python3', required : false)

if cython.found() and py3_dep.found()
py3_dep = dependency('python3')
py3_dep_majver = py3_dep.version().split('.')
py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1]
py3_mod = import('python3')
py3 = py3_mod.find_python()
if py3_dep_majver != py3_mod.language_version()
v = py3_mod.language_version()
error('MESON_SKIP_TEST: deprecated python3 module is non-functional when default python3 is different from Meson\'s', v)
endif
subdir('libdir')

test('cython tester',
Expand Down