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

Skip backport packages for newer python #36776

Merged
merged 6 commits into from
Jan 14, 2024
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
2 changes: 1 addition & 1 deletion build/pkgs/importlib_metadata/install-requires.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# According to https://pypi.org/project/importlib-metadata/,
# 4.13 provides the features of Python 3.11 importlib.metadata
importlib_metadata >=4.13
importlib_metadata >=4.13; python_version<"3.11"
2 changes: 1 addition & 1 deletion build/pkgs/importlib_resources/install-requires.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# According to https://pypi.org/project/importlib-resources/,
# version 5.7 provides the features of Python 3.11 importlib.resources
importlib_resources >= 5.7
importlib_resources >= 5.7; python_version<"3.11"
2 changes: 1 addition & 1 deletion build/pkgs/typing_extensions/install-requires.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# According to https://github.com/python/typing_extensions/blob/main/CHANGELOG.md,
# version 4.4.0 adds another Python 3.11 typing backport
typing_extensions >= 4.4.0
typing_extensions >= 4.4.0; python_version<"3.11"
22 changes: 17 additions & 5 deletions m4/sage_python_package_check.m4
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [
AC_MSG_RESULT(yes)
dnl strip all comments from install-requires.txt; this should leave
dnl only a single line containing the version specification for this
dnl package.
SAGE_PKG_VERSPEC=$(sed '/^#/d' "./build/pkgs/$1/install-requires.txt")
dnl package. Afterwards, convert all double-quotes to single quotes.
dnl Both work, but only single quotes are documented. However, at the
dnl time of writing, double quotes are more compatible with our toml
dnl generation in ./bootstrap. Converting them from double- to single-
dnl quotes on-the-fly here lets us support both (in this macro, at
dnl least).
SAGE_PKG_VERSPEC=$(sed \
-e '/^#/d' \
-e "s/\"/'/g" \
"./build/pkgs/$1/install-requires.txt"
)
AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")])
dnl To prevent user-site (pip install --user) packages from being
Expand All @@ -75,10 +84,13 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [
PYTHONUSERBASE="${HOME}/.sage/local"
])
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
[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]
Expand Down
Loading