Skip to content

Commit 65a64ea

Browse files
author
Release Manager
committed
gh-37319: `build/pkgs/meson`: Update to 1.3.1, require >= 1.2.3 for Python 3.12 support, reject meson installed in inaccessible user schemes <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> As reported in https://groups.google.com/g/sage- devel/c/9ETciH8efTE/m/UfUO7xmsAQAJ, our `configure` script currently accepts "system" meson that will not be functional in our venv. ``` $ pip install --user meson Collecting meson Using cached meson-1.3.1-py3-none-any.whl.metadata (1.8 kB) Using cached meson-1.3.1-py3-none-any.whl (976 kB) Installing collected packages: meson Successfully installed meson-1.3.1 $ python3 -c 'import sysconfig; print(sysconfig.get_path("scripts", "posix_user"))' /Users/mkoeppe/Library/Python/3.11/bin $ /Users/mkoeppe/Library/Python/3.11/bin/meson --version 1.3.1 $ ./sage -sh -c '/Users/mkoeppe/Library/Python/3.11/bin/meson --version' Traceback (most recent call last): File "/Users/mkoeppe/Library/Python/3.11/bin/meson", line 5, in <module> from mesonbuild.mesonmain import main ModuleNotFoundError: No module named 'mesonbuild' ``` Also tightening the version requirement. Only needed for Python 3.12 support (https://github.com/mesonbuild/meson- python/blob/main/pyproject.toml#L36), but we do this unconditionally for simplicity. Also updating meson to latest and changing to a wheel package. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #37319 Reported by: Matthias Köppe Reviewer(s):
2 parents 9cc87c2 + 3212ffe commit 65a64ea

File tree

5 files changed

+54
-44
lines changed

5 files changed

+54
-44
lines changed

build/pkgs/meson/checksums.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tarball=meson-VERSION.tar.gz
2-
sha1=97e766951553ec35315712f0a27d5554a010d4c3
3-
md5=69da4c63ef06c9d3bcc00ce89abb306f
4-
cksum=2424401184
5-
upstream_url=https://pypi.io/packages/source/m/meson/meson-VERSION.tar.gz
1+
tarball=meson-VERSION-py3-none-any.whl
2+
sha1=baf5b9bc9ca97f18c7dc87cfaf0e1dc4d617a4cf
3+
md5=d418e644c04e55872ce3d7b6de007dbe
4+
cksum=559088366
5+
upstream_url=https://pypi.io/packages/py3/m/meson/meson-VERSION-py3-none-any.whl

build/pkgs/meson/package-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3
1+
1.3.1

build/pkgs/meson/spkg-configure.m4

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
SAGE_SPKG_CONFIGURE(
2-
[meson], [
3-
dnl scipy 1.11.2 needs meson >= 1.1.0
4-
dnl contourpy needs meson >= 1.2.0
5-
AC_CACHE_CHECK([for meson >= 1.2.0], [ac_cv_path_MESON], [
6-
AC_PATH_PROGS_FEATURE_CHECK([MESON], [meson], [
7-
meson_version=`$ac_path_MESON --version 2>&1`
8-
AS_IF([test -n "$meson_version"], [
9-
AX_COMPARE_VERSION([$meson_version], [ge], [1.2.0], [
10-
ac_cv_path_MESON="$ac_path_MESON"
11-
ac_path_MESON_found=:
1+
SAGE_SPKG_CONFIGURE([meson], [dnl
2+
dnl scipy 1.11.2 needs meson >= 1.1.0
3+
dnl contourpy needs meson >= 1.2.0
4+
dnl meson_python needs meson >= 1.2.3 for Python >= 3.12
5+
AC_CACHE_CHECK([for meson >= 1.2.3], [ac_cv_path_MESON], [dnl
6+
dnl Do not accept meson installed in the default user scheme;
7+
dnl it will not work in our venv because we set PYTHONUSERBASE
8+
dnl in sage-env.
9+
WITH_SAGE_PYTHONUSERBASE([dnl
10+
AC_PATH_PROGS_FEATURE_CHECK([MESON], [meson], [dnl
11+
AS_IF([meson_version=$($ac_path_MESON --version 2>&1)], [dnl
12+
AS_IF([test -n "$meson_version"], [dnl
13+
AX_COMPARE_VERSION([$meson_version], [ge], [1.2.3], [dnl
14+
ac_cv_path_MESON="$ac_path_MESON"
15+
ac_path_MESON_found=:
16+
])
17+
])
1218
])
1319
])
1420
])

build/pkgs/meson/spkg-install.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

m4/sage_python_package_check.m4

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,19 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [
7171
)
7272
AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")])
7373
74-
dnl To prevent user-site (pip install --user) packages from being
75-
dnl detected as "system" packages, we poison PYTHONUSERBASE. The
76-
dnl sage-env script also does this at runtime; we mimic that
77-
dnl implementation to ensure that the behaviors at ./configure and
78-
dnl runtime are identical. Beware that (as in sage-env) the poisoning
79-
dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the
80-
dnl user points PYTHONUSERBASE to any path (even the default), then
81-
dnl his local pip packages will be detected.
82-
PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}"
83-
AS_IF([test -z "${PYTHONUSERBASE}"], [
84-
PYTHONUSERBASE="${HOME}/.sage/local"
74+
WITH_SAGE_PYTHONUSERBASE([dnl
75+
dnl double-quote SAGE_PKG_VERSPEC because platform-specific
76+
dnl dependencies like python_version<'3.11' will have single
77+
dnl quotes in them. (We normalized the quotes earlier with sed.)
78+
AS_IF(
79+
[config.venv/bin/python3 -c dnl
80+
"import pkg_resources; dnl
81+
pkg_resources.require(\"${SAGE_PKG_VERSPEC}\".splitlines())" dnl
82+
2>&AS_MESSAGE_LOG_FD],
83+
[AC_MSG_RESULT(yes)],
84+
[AC_MSG_RESULT(no); sage_spkg_install_$1=yes]
85+
)
8586
])
86-
87-
dnl double-quote SAGE_PKG_VERSPEC because platform-specific
88-
dnl dependencies like python_version<'3.11' will have single
89-
dnl quotes in them. (We normalized the quotes earlier with sed.)
90-
AS_IF(
91-
[PYTHONUSERBASE="${PYTHONUSERBASE}" config.venv/bin/python3 -c dnl
92-
"import pkg_resources; dnl
93-
pkg_resources.require(\"${SAGE_PKG_VERSPEC}\".splitlines())" dnl
94-
2>&AS_MESSAGE_LOG_FD],
95-
[AC_MSG_RESULT(yes)],
96-
[AC_MSG_RESULT(no); sage_spkg_install_$1=yes]
97-
)
98-
99-
PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}"
10087
], [
10188
dnl failed to create a venv for some reason
10289
AC_MSG_RESULT(no)
@@ -128,3 +115,22 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [
128115
AS_IF([test "${sage_use_system_$1}" = "yes"],[sage_use_system_$1=no])
129116
])
130117
])
118+
119+
120+
AC_DEFUN([WITH_SAGE_PYTHONUSERBASE], [dnl
121+
dnl To prevent user-site (pip install --user) packages from being
122+
dnl detected as "system" packages, we poison PYTHONUSERBASE. The
123+
dnl sage-env script also does this at runtime; we mimic that
124+
dnl implementation to ensure that the behaviors at ./configure and
125+
dnl runtime are identical. Beware that (as in sage-env) the poisoning
126+
dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the
127+
dnl user points PYTHONUSERBASE to any path (even the default), then
128+
dnl his local pip packages will be detected.
129+
PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}"
130+
AS_IF([test -z "${PYTHONUSERBASE}"], [dnl
131+
PYTHONUSERBASE="${HOME}/.sage/local"
132+
export PYTHONUSERBASE
133+
])
134+
$1
135+
PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}"
136+
])

0 commit comments

Comments
 (0)