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

Commit 046f72f

Browse files
author
Matthias Koeppe
committedFeb 4, 2021
Merge branch 't/31227/accept__usr_bin_python3_from_xcode_12_3_on_macos_10_15__catalina_' into t/30770/public/build/ecl-config
2 parents 11ad40a + fc8b676 commit 046f72f

15 files changed

+164
-56
lines changed
 

‎.github/workflows/tox.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
os: [ macos-10.15, macos-11.0 ]
106106
tox_system_factor: [homebrew-macos, homebrew-macos-python3_xcode, homebrew-macos-python3_xcode-nokegonly, homebrew-macos-python3_pythonorg, homebrew-macos-python3_xcode-gcc_spkg, conda-forge-macos]
107107
tox_packages_factor: [minimal, standard]
108-
xcode_version_factor: [11.7, default, 12.3]
108+
xcode_version_factor: [11.7, 12.2, default, 12.4]
109109
env:
110110
TOX_ENV: local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
111111
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}-${{ matrix.os }}-xcode_${{ matrix.xcode_version_factor }}
@@ -223,7 +223,7 @@ jobs:
223223
os: [ macos-10.15, macos-11.0 ]
224224
tox_system_factor: [macos-nobootstrap, macos-nobootstrap-python3_pythonorg]
225225
tox_packages_factor: [minimal]
226-
xcode_version_factor: [default, 12]
226+
xcode_version_factor: [11.7, 12.2, default, 12.4]
227227
env:
228228
TOX_ENV: local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
229229
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}-xcode_${{ matrix.xcode_version_factor }}

‎build/pkgs/cmake/spkg-install.in

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
if [ "$UNAME" = Darwin ]; then
22
CC=clang
33
CXX=clang++
4+
export CFLAGS="$CFLAGS_NON_NATIVE"
5+
export CXXFLAGS="$CXXFLAGS_NON_NATIVE"
46
fi
57

68
cd src

‎build/pkgs/curl/spkg-install.in

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if [ "$UNAME" = "Darwin" ]; then
1010
if [ $MACOSX_VERSION -ge 16 ]; then
1111
echo "OS X 10.$[$MACOSX_VERSION-4] Building with clang and --with-darwinssl."
1212
CC=clang
13+
export CFLAGS="$CFLAGS_NON_NATIVE"
1314
CURL_CONFIGURE="--with-darwinssl $CURL_CONFIGURE"
1415
fi
1516
fi

‎build/pkgs/pari/spkg-install.in

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ unset dfltlibdir dfltmandir dfltsysdatadir dfltobjdir
105105

106106
# Avoid segmentation fault on macOS Catalina with XCode 11.4
107107
# #29451
108-
MACOSX_VERSION=`uname -r | awk -F. '{print $1}'`
109108
if [ $MACOSX_VERSION -ge 14 ]; then
110109
# various packages have still have issues with
111110
# two digit OS X versions

‎build/pkgs/pip/checksums.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tarball=pip-VERSION.tar.gz
2-
sha1=5e708de15d0959386595bea819d75fbc5d4480b3
3-
md5=efd9dc5c7405452c72c0e3cd410a2018
4-
cksum=3748660343
2+
sha1=a8c85abfdc0bf15dd7360865f59e4234be00d1e2
3+
md5=3d5d0639042c829bba411d3735267546
4+
cksum=4219824548
55
upstream_url=https://pypi.io/packages/source/p/pip/pip-VERSION.tar.gz

‎build/pkgs/pip/package-version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.2.3
1+
20.3.3

‎build/pkgs/psutil/spkg-install.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
if [ "$UNAME" = "Darwin" ] && [ $MACOSX_VERSION -ge 16 ]; then
22
echo "OS X 10.$[$MACOSX_VERSION-4] Building with clang."
33
CC=clang
4+
export CFLAGS="$CFLAGS_NON_NATIVE"
45
fi
56

67
cd src && sdh_pip_install .

‎build/pkgs/python3/checksums.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tarball=Python-VERSION.tar.xz
2-
sha1=68d6c7f948801cc755905162f5ee7589595edee4
3-
md5=35b5a3d0254c1c59be9736373d429db7
4-
cksum=2309344767
2+
sha1=77f4105846f6740297e50d7535a42c02d6b8e7db
3+
md5=61981498e75ac8f00adcb908281fadb6
4+
cksum=4032849512
55
upstream_url=https://www.python.org/ftp/python/VERSION/Python-VERSION.tar.xz
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8.5
1+
3.9.1

‎build/pkgs/python3/spkg-build.in

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ if [ "$SAGE_VALGRIND" = "yes" ]; then
2020
PYTHON_CONFIGURE="$PYTHON_CONFIGURE --without-pymalloc"
2121
fi
2222

23-
# Use EXTRA_CFLAGS for user-defined CFLAGS since Python puts its own
24-
# default flags like -O3 after CFLAGS but before EXTRA_CFLAGS.
25-
# We also disable warnings about unused variables/functions which are
26-
# common in Cython-generated code.
27-
export EXTRA_CFLAGS="`testcflags.sh -Wno-unused` $CFLAGS"
23+
# We will use EXTRA_CFLAGS for user-defined CFLAGS below.
24+
OLD_CFLAGS="$CFLAGS"
2825
unset CFLAGS
2926

3027
if [ "$UNAME" = Darwin ]; then
@@ -58,6 +55,12 @@ elif [ "$UNAME" = SunOS ]; then
5855
export CFLAGS="-D__C99FEATURES__ $CFLAGS"
5956
fi
6057

58+
# Use EXTRA_CFLAGS for user-defined CFLAGS since Python puts its own
59+
# default flags like -O3 after CFLAGS but before EXTRA_CFLAGS.
60+
# We also disable warnings about unused variables/functions which are
61+
# common in Cython-generated code.
62+
export EXTRA_CFLAGS="`testcflags.sh -Wno-unused $OLD_CFLAGS`"
63+
6164
# Remove old symbolic link: it is not needed and its presence can
6265
# interfere with the Python build.
6366
rm -f "$SAGE_LOCAL/lib/python"

‎build/pkgs/python3/spkg-configure.m4

+45-10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ SAGE_SPKG_CONFIGURE([python3], [
2929
SAGE_CHECK_PYTHON_FOR_VENV([$ac_path_PYTHON3],
3030
MIN_VERSION, LT_VERSION,
3131
$check_modules, [
32+
AS_IF([[conftest_venv/bin/python3 -m sysconfig | grep '^\sw*\(C\|LD\)FLAGS *=.*[" ]-[IL]' ]] [>& AS_MESSAGE_LOG_FD 2>&1 ], [
33+
AC_MSG_WARN([this is a misconfigured Python whose sysconfig compiler/linker flags contain -I or -L options, which may cause wrong versions of libraries to leak into the build of Python packages - see https://trac.sagemath.org/ticket/31132])
34+
])
3235
dnl It is good
3336
ac_cv_path_PYTHON3="$ac_path_PYTHON3"
3437
ac_path_PYTHON3_found=:
@@ -45,27 +48,59 @@ SAGE_SPKG_CONFIGURE([python3], [
4548
SAGE_CHECK_PYTHON_FOR_VENV([$ac_path_PYTHON3],
4649
MIN_VERSION, LT_VERSION,
4750
$check_modules, [
48-
dnl It is good
49-
ac_cv_path_PYTHON3="$ac_path_PYTHON3"
50-
ac_path_PYTHON3_found=:
51-
AC_MSG_RESULT([yes])
52-
dnl introduction for AC_MSG_RESULT printed by AC_CACHE_CHECK
53-
AC_MSG_CHECKING([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules])
51+
AS_IF([[conftest_venv/bin/python3 -m sysconfig | grep '^\sw*\(C\|LD\)FLAGS *=.*[" ]-[IL]' ]] [>& AS_MESSAGE_LOG_FD 2>&1 ], [
52+
AC_MSG_RESULT([no, this is a misconfigured Python whose sysconfig compiler/linker flags contain -I or -L options, which may cause wrong versions of libraries to leak into the build of Python packages - see https://trac.sagemath.org/ticket/31132; to use it anyway, use ./configure --with-python=$ac_path_PYTHON3])
53+
], [
54+
dnl It is good
55+
ac_cv_path_PYTHON3="$ac_path_PYTHON3"
56+
ac_path_PYTHON3_found=:
57+
AC_MSG_RESULT([yes])
58+
dnl introduction for AC_MSG_RESULT printed by AC_CACHE_CHECK
59+
AC_MSG_CHECKING([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules])
60+
])
5461
])
5562
])
5663
])
5764
])
58-
AS_IF([test -z "$ac_cv_path_PYTHON3"], [sage_spkg_install_python3=yes])
65+
AS_IF([test -z "$ac_cv_path_PYTHON3"], [
66+
AC_MSG_NOTICE([to try to use a different system python, use ./configure --with-python=/path/to/python])
67+
sage_spkg_install_python3=yes
68+
])
5969
m4_popdef([MIN_VERSION])
6070
m4_popdef([LT_VERSION])
6171
])
6272
],, [
6373
dnl PRE
6474
], [
6575
dnl POST
66-
AS_IF([test x$sage_spkg_install_python3 = xno],
67-
[PYTHON_FOR_VENV="$ac_cv_path_PYTHON3"],
68-
[SAGE_MACOSX_DEPLOYMENT_TARGET=legacy])
76+
AS_IF([test x$sage_spkg_install_python3 = xno], [
77+
PYTHON_FOR_VENV="$ac_cv_path_PYTHON3"
78+
AS_IF([test "$SAGE_ARCHFLAGS" = "unset"], [
79+
AC_MSG_CHECKING([whether $PYTHON_FOR_VENV is configured to build multiarch extensions])
80+
AS_IF([[CC="$CC" CXX="$CXX" conftest_venv/bin/python3 -m sysconfig | grep '^\sw*\(C\|LD\)FLAGS *=.*[" ]-arch.* -arch' ]] [>& AS_MESSAGE_LOG_FD 2>&1 ], [
81+
AC_MSG_RESULT([yes; disabling it by setting ARCHFLAGS])
82+
SAGE_ARCHFLAGS=""
83+
], [
84+
AC_MSG_RESULT([no])
85+
])
86+
])
87+
AS_IF([test "$SAGE_ARCHFLAGS" != "unset"], [
88+
ARCHFLAGS="$SAGE_ARCHFLAGS"
89+
export ARCHFLAGS
90+
])
91+
AS_IF([test -n "$CFLAGS_MARCH"], [
92+
dnl Trac #31228
93+
AC_MSG_CHECKING([whether "$CFLAGS_MARCH" works with the C/C++ compilers configured for building extensions for $PYTHON_FOR_VENV])
94+
SAGE_PYTHON_CHECK_DISTUTILS([CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS_MARCH" conftest_venv/bin/python3], [
95+
AC_MSG_RESULT([yes])
96+
], [
97+
AC_MSG_RESULT([no, with these flags, $reason; disabling use of "$CFLAGS_MARCH"])
98+
CFLAGS_MARCH=""
99+
])
100+
])
101+
], [
102+
SAGE_MACOSX_DEPLOYMENT_TARGET=legacy
103+
])
69104
AC_SUBST([PYTHON_FOR_VENV])
70105
AC_SUBST([SAGE_MACOSX_DEPLOYMENT_TARGET])
71106

‎m4/sage_check_python_for_venv.m4

+80-30
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ AC_DEFUN([SAGE_CHECK_PYTHON_FOR_VENV], [
77
m4_pushdef([REQUIRED_MODULES], [$4])
88
m4_pushdef([COMMANDS_IF_GOOD], [$5])
99
10+
AC_SUBST([SAGE_ARCHFLAGS])
11+
1012
AC_MSG_CHECKING([... whether ]PYTHON_EXE[ is good])
1113
python3_version=`"PYTHON_EXE" --version 2>&1 \
1214
| $SED -n -e 's/\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*/\1/p'`
@@ -19,6 +21,80 @@ AC_DEFUN([SAGE_CHECK_PYTHON_FOR_VENV], [
1921
dnl m4_define([conftest_venv], [config-venv]) .... for debugging only
2022
rm -rf conftest_venv
2123
AS_IF(["]PYTHON_EXE[" build/bin/sage-venv conftest_venv && conftest_venv/bin/python3 -c "import ]REQUIRED_MODULES["], [
24+
AS_VAR_SET([python3_result], [yes])
25+
SAGE_PYTHON_CHECK_DISTUTILS([CC="$CC" CXX="$CXX" conftest_venv/bin/python3], [
26+
SAGE_ARCHFLAGS="unset"
27+
], [
28+
AS_CASE([$host],
29+
[*-*-darwin*], [
30+
dnl #31227: Try if setting ARCHFLAGS to empty fixes it
31+
SAGE_PYTHON_CHECK_DISTUTILS([CC="$CC" CXX="$CXX" ARCHFLAGS="" conftest_venv/bin/python3], [
32+
SAGE_ARCHFLAGS=""
33+
], [
34+
AS_VAR_SET([python3_result],
35+
["no, the version is in the supported range, and the modules can be imported, but $reason (even with ARCHFLAGS set to empty)"])
36+
])
37+
], [
38+
AS_VAR_SET([python3_result],
39+
["no, the version is in the supported range, and the modules can be imported, but $reason"])
40+
])
41+
])
42+
AS_VAR_IF([python3_result], [yes], [
43+
dnl these commands are expected to call AC_MSG_RESULT
44+
COMMANDS_IF_GOOD
45+
], [
46+
AC_MSG_RESULT([$python3_result])
47+
])
48+
], [
49+
AC_MSG_RESULT([no, the version is in the supported range but cannot import one of the required modules: ]REQUIRED_MODULES)
50+
])
51+
], [
52+
AC_MSG_RESULT([no, $python3_version is too recent])
53+
])
54+
], [
55+
AC_MSG_RESULT([no, $python3_version is too old])
56+
])
57+
], [
58+
AC_MSG_RESULT([no, "]PYTHON_EXE[ --version" does not work])
59+
])
60+
61+
62+
m4_popdef([PYTHON_EXE])
63+
m4_popdef([MIN_VERSION])
64+
m4_popdef([LT_VERSION])
65+
m4_popdef([REQUIRED_MODULES])
66+
m4_popdef([COMMANDS_IF_GOOD])
67+
68+
])
69+
70+
dnl distutils test
71+
AC_DEFUN([SAGE_PYTHON_CHECK_DISTUTILS], [
72+
m4_pushdef([PYTHON_EXE], [$1])
73+
m4_pushdef([COMMANDS_IF_DISTUTILS_GOOD], [$2])
74+
m4_pushdef([COMMANDS_IF_DISTUTILS_NOT_GOOD], [$3])
75+
SAGE_PYTHON_DISTUTILS_C_CONFTEST
76+
dnl (echo "***ENV***:"; env; echo "***SYSCONFIG***"; conftest_venv/bin/python3 -m sysconfig) >& AS_MESSAGE_LOG_FD
77+
echo PYTHON_EXE conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD
78+
AS_IF([PYTHON_EXE conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD 2>&1 ], [
79+
SAGE_PYTHON_DISTUTILS_CXX_CONFTEST
80+
echo PYTHON_EXE conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD 2>&1
81+
AS_IF([PYTHON_EXE conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD 2>&1 ], [
82+
COMMANDS_IF_DISTUTILS_GOOD], [
83+
reason="distutils cannot build a C++ 11 extension"
84+
COMMANDS_IF_DISTUTILS_NOT_GOOD
85+
])
86+
], [
87+
reason="distutils cannot build a C extension"
88+
COMMANDS_IF_DISTUTILS_NOT_GOOD
89+
])
90+
m4_popdef([PYTHON_EXE])
91+
m4_popdef([COMMANDS_IF_DISTUTILS_GOOD])
92+
m4_popdef([COMMANDS_IF_DISTUTILS_NOT_GOOD])
93+
])
94+
95+
dnl Write conftest.py and conftest.c
96+
AC_DEFUN([SAGE_PYTHON_DISTUTILS_C_CONFTEST], [
97+
rm -rf conftest.*
2298
AC_LANG_PUSH([C])
2399
AC_LANG_CONFTEST([
24100
AC_LANG_SOURCE([[
@@ -54,9 +130,10 @@ modules = list((Extension("config_check_distutils", list(("conftest.c",))),))
54130
setup(name="config_check_distutils", ext_modules=modules)
55131
exit(0)
56132
EOF
57-
dnl (echo "***ENV***:"; env; echo "***SYSCONFIG***"; conftest_venv/bin/python3 -m sysconfig) >& AS_MESSAGE_LOG_FD
58-
echo CC="$CC" CXX="$CXX" conftest_venv/bin/python3 conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD
59-
AS_IF([CC="$CC" CXX="$CXX" conftest_venv/bin/python3 conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD 2>&1 ], [
133+
])
134+
135+
dnl Write conftest.py and conftest.cpp
136+
AC_DEFUN([SAGE_PYTHON_DISTUTILS_CXX_CONFTEST], [
60137
rm -rf conftest.*
61138
AC_LANG_PUSH([C++])
62139
AC_LANG_CONFTEST([
@@ -107,31 +184,4 @@ modules = list((Extension("config_check_distutils_cxx", list(("conftest.cpp",)),
107184
setup(name="config_check_distutils_cxx", ext_modules=modules)
108185
exit(0)
109186
EOF
110-
AS_IF([CC="$CC" CXX="$CXX" conftest_venv/bin/python3 conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD 2>&1 ],
111-
[COMMANDS_IF_GOOD], [
112-
AC_MSG_RESULT([no, the version is in the supported range, and the modules can be imported, but distutils cannot build a C++ 11 extension])
113-
])
114-
], [
115-
AC_MSG_RESULT([no, the version is in the supported range, and the modules can be imported, but distutils cannot build a C extension])
116-
])
117-
], [
118-
AC_MSG_RESULT([no, the version is in the supported range but cannot import one of the required modules: ]REQUIRED_MODULES)
119-
])
120-
], [
121-
AC_MSG_RESULT([no, $python3_version is too recent])
122-
])
123-
], [
124-
AC_MSG_RESULT([no, $python3_version is too old])
125-
])
126-
], [
127-
AC_MSG_RESULT([no, "]PYTHON_EXE[ --version" does not work])
128-
])
129-
130-
131-
m4_popdef([PYTHON_EXE])
132-
m4_popdef([MIN_VERSION])
133-
m4_popdef([LT_VERSION])
134-
m4_popdef([REQUIRED_MODULES])
135-
m4_popdef([COMMANDS_IF_GOOD])
136-
137187
])

‎src/bin/sage-env

+10
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ export F77="$FC"
202202
export F90="$FC" # Needed for SciPy
203203
export F95="$FC"
204204

205+
# For ARCHFLAGS (#31227) we need to distinguish unset and empty.
206+
# If the environment defines ARCHFLAGS, even when empty, then take that.
207+
# Otherwise, use the configured value; but if that is "unset", do not set
208+
# the variable at all.
209+
if [ "${ARCHFLAGS-unset}" = "unset" ]; then
210+
if [ "${SAGE_ARCHFLAGS-unset}" != "unset" ]; then
211+
export ARCHFLAGS="${SAGE_ARCHFLAGS}"
212+
fi
213+
fi
214+
205215
# Call with: contains_spaces X${VAR}X
206216
# i.e., WITHOUT quotes but some character(s) around the environment variable to test.
207217
# (This function does return false for empty/unset variables.)

‎src/bin/sage-env-config.in

+1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ CONFIGURED_OBJCXX="@OBJCXX@"
5050
#######################################
5151
# Other configuration (not exported, only used in sage-env)
5252
#######################################
53+
SAGE_ARCHFLAGS="@SAGE_ARCHFLAGS@"
5354
SAGE_PKG_CONFIG_PATH="@SAGE_PKG_CONFIG_PATH@"
5455
SAGE_MACOSX_DEPLOYMENT_TARGET="@SAGE_MACOSX_DEPLOYMENT_TARGET@"

‎tox.ini

+6
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ setenv =
372372
macos-python3_xcode: CONFIG_CONFIGURE_ARGS_1=--with-python=/usr/bin/python3
373373
# Must manually download and install from https://www.python.org/ftp/python/3.7.7/python-3.7.7-macosx10.9.pkg
374374
macos-python3_pythonorg: CONFIG_CONFIGURE_ARGS_1=--with-python=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
375+
# Homebrew keg installs
376+
homebrew-python3.7: CONFIG_CONFIGURE_ARGS_1=--with-python={env:HOMEBREW}/opt/python@3.7/bin/python3
377+
homebrew-python3.8: CONFIG_CONFIGURE_ARGS_1=--with-python={env:HOMEBREW}/opt/python@3.8/bin/python3
378+
homebrew-python3.9: CONFIG_CONFIGURE_ARGS_1=--with-python={env:HOMEBREW}/opt/python@3.9/bin/python3
375379
# https://github.com/pypa/manylinux
376380
manylinux-standard: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp38-cp38/bin/python3
377381
manylinux-python3.6: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp36-cp36m/bin/python3
@@ -383,6 +387,8 @@ setenv =
383387
#
384388
gcc_spkg: CONFIG_CONFIGURE_ARGS_2=--without-system-gcc
385389
gcc_9: CONFIG_CONFIGURE_ARGS_2=CC=gcc-9 CXX=g++-9 FC=gfortran-9
390+
gcc_10: CONFIG_CONFIGURE_ARGS_2=CC=gcc-10 CXX=g++-10 FC=gfortran-10
391+
gcc_11: CONFIG_CONFIGURE_ARGS_2=CC=gcc-11 CXX=g++-11 FC=gfortran-11
386392
#
387393
# Resulting full configuration args, including EXTRA_CONFIGURE_ARGS from the user environment
388394
#

0 commit comments

Comments
 (0)
This repository has been archived.