Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 't/30576/public/30576' into t/30546/build/py3x_conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 24, 2020
2 parents b21ed97 + 945c8c5 commit 8906897
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
10 changes: 9 additions & 1 deletion build/bin/sage-site
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,15 @@ if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then
# tends to ask interactive questions if something goes wrong. These
# cause the build to hang. If stdin is /dev/null, TeX just aborts.
shift
export LANG=C # to ensure it is possible to scrape out non-EN locale warnings

# Trac #30002: ensure an English locale so that it is possible to
# scrape out warnings by pattern matching.
# Trac #30576: But we have to avoid the C locale, which disables
# proper UTF-8 operation in Python 3.6 or older.
LC_ALL=$(locale -a | grep -E -i '^(c|en_us)[-.]utf-?8$' | head -n 1)
LANG=$LC_ALL
export LC_ALL
export LANG

# See #30351: bugs in macOS implementations of openblas/libgopm can cause
# docbuild to hang if multiple OpenMP threads are allowed.
Expand Down
10 changes: 10 additions & 0 deletions build/bin/sage-system-python
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ fi
# is accessible by this python; this is to guard on Cygwin against Pythons
# installed somewhere else in Windows.

# Trac #30008: Make it work even if the environment tries to sabotage UTF-8
# operation in Python 3.0.x-3.6.x by setting LC_ALL=C or similar.

if [ "$LC_ALL" = "C" -o "$LANG" = "C" -o "$LC_CTYPE" = "C" ]; then
LC_ALL=$(locale -a | grep -E -i '^(c|en_us)[-.]utf-?8$' | head -n 1)
LANG=$LC_ALL
export LC_ALL
export LANG
fi

PYTHONS="python python3 python3.8 python3.7 python2.7 python3.6 python2"
for PY in $PYTHONS; do
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SAGE_SPKG_CONFIGURE([python3], [
dnl 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"
m4_pushdef([MIN_VERSION], [3.7.0])
m4_pushdef([MIN_VERSION], [3.6.0])
m4_pushdef([LT_VERSION], [3.9.0])
AC_CACHE_CHECK([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules], [ac_cv_path_PYTHON3], [
AS_IF([test x"$ac_path_PYTHON3" != x], [dnl checking explicitly specified $with_python
Expand Down
9 changes: 7 additions & 2 deletions build/sage_bootstrap/uncompress/tar_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@

class SageBaseTarFile(tarfile.TarFile):
"""
Sage as tarfile.TarFile, but applies a reasonable umask (0022) to the
permissions of all extracted files and directories.
Same as tarfile.TarFile, but applies a reasonable umask (0022) to the
permissions of all extracted files and directories, and fixes
the encoding of file names in the tarball to be 'utf-8' instead of
depending on locale settings.
Previously this applied the user's current umask per the default behavior
of the ``tar`` utility, but this did not provide sufficiently reliable
Expand All @@ -46,6 +48,9 @@ class SageBaseTarFile(tarfile.TarFile):
umask = 0o022

def __init__(self, *args, **kwargs):

kwargs['encoding'] = 'utf-8'

# Unfortunately the only way to get the current umask is to set it
# and then restore it
super(SageBaseTarFile, self).__init__(*args, **kwargs)
Expand Down

0 comments on commit 8906897

Please sign in to comment.