Skip to content

Commit

Permalink
sagemathgh-37504: cmake, ninja_build: Reject installations in ina…
Browse files Browse the repository at this point in the history
…ccessible user schemes

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

These two are installable via binary wheels on PyPI.
When they are installed with `pip install --user`, as appears to be
becoming more popular, then our `configure` script will see them, but
they will not work within the Sage environment because we set
PYTHONUSERBASE.

Fix as done previously for `meson` in sagemath#37319.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [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. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
- Depends on sagemath#37319 (merged here)

URL: sagemath#37504
Reported by: Matthias Köppe
Reviewer(s):
  • Loading branch information
Release Manager committed Mar 4, 2024
2 parents fc0d339 + cdcc434 commit 872ca39
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
24 changes: 14 additions & 10 deletions build/pkgs/cmake/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
SAGE_SPKG_CONFIGURE(
[cmake], [
AC_CACHE_CHECK([for cmake >= 3.11], [ac_cv_path_CMAKE], [
AC_PATH_PROGS_FEATURE_CHECK([CMAKE], [cmake], [
cmake_version=`$ac_path_CMAKE --version 2>&1 \
| $SED -n -e 's/cmake version *\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)/\1/p'`
AS_IF([test -n "$cmake_version"], [
AX_COMPARE_VERSION([$cmake_version], [ge], [3.11], [
ac_cv_path_CMAKE="$ac_path_CMAKE"
ac_path_CMAKE_found=:
SAGE_SPKG_CONFIGURE([cmake], [dnl
AC_CACHE_CHECK([for cmake >= 3.11], [ac_cv_path_CMAKE], [dnl
dnl Do not accept cmake installed via https://pypi.org/project/cmake/
dnl in the default user scheme; it will not work in our venv because
dnl we set PYTHONUSERBASE in sage-env.
WITH_SAGE_PYTHONUSERBASE([dnl
AC_PATH_PROGS_FEATURE_CHECK([CMAKE], [cmake], [dnl
cmake_version=`$ac_path_CMAKE --version 2>&1 \
| $SED -n -e 's/cmake version *\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)/\1/p'`
AS_IF([test -n "$cmake_version"], [dnl
AX_COMPARE_VERSION([$cmake_version], [ge], [3.11], [dnl
ac_cv_path_CMAKE="$ac_path_CMAKE"
ac_path_CMAKE_found=:
])
])
])
])
Expand Down
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=b0dfc1d5886366b5c58354527810c1dbeffd78a3
md5=c2f9837bcf2823d5b2f36063ebeedb38
cksum=3535625335
sha1=26e8d2b6804d9474bed32cba580e9edd9947723c
md5=b6b9dbb57d17ba53f57f37f74c66a24c
cksum=3731157415
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
686e933eb32ade977ed51836a33424e2095e5408
4163e69cf94a4fbcf59e1297de0a4644d2e4291a
30 changes: 17 additions & 13 deletions build/pkgs/ninja_build/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
SAGE_SPKG_CONFIGURE(
[ninja_build], [
dnl meson_python needs 1.8.2 or later
AC_CACHE_CHECK([for ninja >= 1.8.2], [ac_cv_path_NINJA], [
AC_PATH_PROGS_FEATURE_CHECK([NINJA], [ninja], [
dnl support both two- and three-component version schemes
dnl since samurai (a ninja alternative) uses two
ninja_version=`$ac_path_NINJA --version 2>&1 \
| $SED -n -e 's/\([[0-9]]*\(\.[[0-9]]*\)\{1,2\}\).*/\1/p'`
AS_IF([test -n "$ninja_version"], [
AX_COMPARE_VERSION([$ninja_version], [ge], [1.8.2], [
ac_cv_path_NINJA="$ac_path_NINJA"
ac_path_NINJA_found=:
SAGE_SPKG_CONFIGURE([ninja_build], [dnl
dnl meson_python needs 1.8.2 or later
AC_CACHE_CHECK([for ninja >= 1.8.2], [ac_cv_path_NINJA], [dnl
dnl Do not accept ninja installed from https://pypi.org/project/ninja/
dnl in the default user scheme; it will not work in our venv because
dnl we set PYTHONUSERBASE in sage-env.
WITH_SAGE_PYTHONUSERBASE([dnl
AC_PATH_PROGS_FEATURE_CHECK([NINJA], [ninja], [dnl
dnl support both two- and three-component version schemes
dnl since samurai (a ninja alternative) uses two
ninja_version=`$ac_path_NINJA --version 2>&1 \
| $SED -n -e 's/\([[0-9]]*\(\.[[0-9]]*\)\{1,2\}\).*/\1/p'`
AS_IF([test -n "$ninja_version"], [dnl
AX_COMPARE_VERSION([$ninja_version], [ge], [1.8.2], [
ac_cv_path_NINJA="$ac_path_NINJA"
ac_path_NINJA_found=:
])
])
])
])
Expand Down

0 comments on commit 872ca39

Please sign in to comment.