Skip to content

Commit

Permalink
Trac #30053: Python 3.7+: setlocale: LC_ALL: cannot change locale (C.…
Browse files Browse the repository at this point in the history
…UTF-8) from build/bin/sage-spkg and in doctests; disable use of system Python 3.6

In #29033 in `build/bin/sage-spkg` LC_ALL was changed to C.UTF-8
However, not all systems have it.

See also:
 - #22659

Follow-up:
 - #30586 macOS: Doctest failures in some locales
 - #30576 Python 3.6: Fix locale/encoding issues, then re-enable Python
3.6

URL: https://trac.sagemath.org/30053
Reported by: dimpase
Ticket author(s): Dima Pasechnik, Matthias Koeppe
Reviewer(s): Matthias Koeppe, Dima Pasechnik
  • Loading branch information
Release Manager committed Sep 20, 2020
2 parents 99faab8 + be47518 commit a760832
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@

# Avoid surprises with character ranges [a-z] in regular expressions
# See Trac #15791; some locales can produce different results for
# character ranges (use C.UTF-8 to ensure UTF-8 default encoding in Python)
export LC_ALL=C.UTF-8
# character ranges; using C.UTF-8 to ensure UTF-8 default encoding in Python
# introduces extra complications, see #30053, so we don't do it, but
# assume we are on Python3.x, for x at least 7.
export LC_ALL=C

usage()
{
Expand Down
6 changes: 3 additions & 3 deletions build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ SAGE_SPKG_CONFIGURE([python3], [
dnl Using Python 3 for Sage. Check if we can do venv with a system python3
dnl instead of building our own copy.
check_modules="sqlite3, ctypes, math, hashlib, crypt, readline, socket, zlib, distutils.core"
AC_CACHE_CHECK([for python3 >= 3.6, < 3.9 with modules $check_modules], [ac_cv_path_PYTHON3], [
AC_CACHE_CHECK([for python3 >= 3.7, < 3.9 with modules $check_modules], [ac_cv_path_PYTHON3], [
AC_MSG_RESULT([])
AC_PATH_PROGS_FEATURE_CHECK([PYTHON3], [python3.8 python3.7 python3.6 python3], [
AC_PATH_PROGS_FEATURE_CHECK([PYTHON3], [python3.8 python3.7 python3], [
AC_MSG_CHECKING([... whether $ac_path_PYTHON3 is good])
python3_version=`"$ac_path_PYTHON3" --version 2>&1 \
| $SED -n -e 's/\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*/\1/p'`
AS_IF([test -n "$python3_version"], [
AX_COMPARE_VERSION([$python3_version], [ge], [3.6.0], [
AX_COMPARE_VERSION([$python3_version], [ge], [3.7.0], [
AX_COMPARE_VERSION([$python3_version], [lt], [3.9.0], [
dnl Because the system python is not used directly but rather in a venv without site-packages,
dnl we test whether the module will be available in a venv.
Expand Down

0 comments on commit a760832

Please sign in to comment.