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

build/pkgs/meson: Update to 1.3.1, require >= 1.2.3 for Python 3.12 support, reject meson installed in inaccessible user schemes #37319

Merged
merged 7 commits into from
Feb 29, 2024
10 changes: 5 additions & 5 deletions build/pkgs/meson/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=meson-VERSION.tar.gz
sha1=97e766951553ec35315712f0a27d5554a010d4c3
md5=69da4c63ef06c9d3bcc00ce89abb306f
cksum=2424401184
upstream_url=https://pypi.io/packages/source/m/meson/meson-VERSION.tar.gz
tarball=meson-VERSION-py3-none-any.whl
sha1=baf5b9bc9ca97f18c7dc87cfaf0e1dc4d617a4cf
md5=d418e644c04e55872ce3d7b6de007dbe
cksum=559088366
upstream_url=https://pypi.io/packages/py3/m/meson/meson-VERSION-py3-none-any.whl
2 changes: 1 addition & 1 deletion build/pkgs/meson/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.3
1.3.1
28 changes: 17 additions & 11 deletions build/pkgs/meson/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
SAGE_SPKG_CONFIGURE(
[meson], [
dnl scipy 1.11.2 needs meson >= 1.1.0
dnl contourpy needs meson >= 1.2.0
AC_CACHE_CHECK([for meson >= 1.2.0], [ac_cv_path_MESON], [
AC_PATH_PROGS_FEATURE_CHECK([MESON], [meson], [
meson_version=`$ac_path_MESON --version 2>&1`
AS_IF([test -n "$meson_version"], [
AX_COMPARE_VERSION([$meson_version], [ge], [1.2.0], [
ac_cv_path_MESON="$ac_path_MESON"
ac_path_MESON_found=:
SAGE_SPKG_CONFIGURE([meson], [dnl
dnl scipy 1.11.2 needs meson >= 1.1.0
dnl contourpy needs meson >= 1.2.0
dnl meson_python needs meson >= 1.2.3 for Python >= 3.12
AC_CACHE_CHECK([for meson >= 1.2.3], [ac_cv_path_MESON], [dnl
dnl Do not accept meson installed in the default user scheme;
dnl it will not work in our venv because we set PYTHONUSERBASE
dnl in sage-env.
WITH_SAGE_PYTHONUSERBASE([dnl
AC_PATH_PROGS_FEATURE_CHECK([MESON], [meson], [dnl
AS_IF([meson_version=$($ac_path_MESON --version 2>&1)], [dnl
AS_IF([test -n "$meson_version"], [dnl
AX_COMPARE_VERSION([$meson_version], [ge], [1.2.3], [dnl
ac_cv_path_MESON="$ac_path_MESON"
ac_path_MESON_found=:
])
])
])
])
])
Expand Down
2 changes: 0 additions & 2 deletions build/pkgs/meson/spkg-install.in

This file was deleted.

56 changes: 31 additions & 25 deletions m4/sage_python_package_check.m4
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,19 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [
)
AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")])

dnl To prevent user-site (pip install --user) packages from being
dnl detected as "system" packages, we poison PYTHONUSERBASE. The
dnl sage-env script also does this at runtime; we mimic that
dnl implementation to ensure that the behaviors at ./configure and
dnl runtime are identical. Beware that (as in sage-env) the poisoning
dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the
dnl user points PYTHONUSERBASE to any path (even the default), then
dnl his local pip packages will be detected.
PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}"
AS_IF([test -z "${PYTHONUSERBASE}"], [
PYTHONUSERBASE="${HOME}/.sage/local"
WITH_SAGE_PYTHONUSERBASE([dnl
dnl double-quote SAGE_PKG_VERSPEC because platform-specific
dnl dependencies like python_version<'3.11' will have single
dnl quotes in them. (We normalized the quotes earlier with sed.)
AS_IF(
[config.venv/bin/python3 -c dnl
"import pkg_resources; dnl
pkg_resources.require(\"${SAGE_PKG_VERSPEC}\".splitlines())" dnl
2>&AS_MESSAGE_LOG_FD],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); sage_spkg_install_$1=yes]
)
])

dnl double-quote SAGE_PKG_VERSPEC because platform-specific
dnl dependencies like python_version<'3.11' will have single
dnl quotes in them. (We normalized the quotes earlier with sed.)
AS_IF(
[PYTHONUSERBASE="${PYTHONUSERBASE}" config.venv/bin/python3 -c dnl
"import pkg_resources; dnl
pkg_resources.require(\"${SAGE_PKG_VERSPEC}\".splitlines())" dnl
2>&AS_MESSAGE_LOG_FD],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); sage_spkg_install_$1=yes]
)

PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}"
], [
dnl failed to create a venv for some reason
AC_MSG_RESULT(no)
Expand Down Expand Up @@ -128,3 +115,22 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [
AS_IF([test "${sage_use_system_$1}" = "yes"],[sage_use_system_$1=no])
])
])


AC_DEFUN([WITH_SAGE_PYTHONUSERBASE], [dnl
dnl To prevent user-site (pip install --user) packages from being
dnl detected as "system" packages, we poison PYTHONUSERBASE. The
dnl sage-env script also does this at runtime; we mimic that
dnl implementation to ensure that the behaviors at ./configure and
dnl runtime are identical. Beware that (as in sage-env) the poisoning
dnl is skipped if PYTHONUSERBASE is non-empty. In particular, if the
dnl user points PYTHONUSERBASE to any path (even the default), then
dnl his local pip packages will be detected.
PYTHONUSERBASE_SAVED="${PYTHONUSERBASE}"
AS_IF([test -z "${PYTHONUSERBASE}"], [dnl
PYTHONUSERBASE="${HOME}/.sage/local"
export PYTHONUSERBASE
])
$1
PYTHONUSERBASE="${PYTHONUSERBASE_SAVED}"
])
Loading