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

Commit fb5366d

Browse files
author
Matthias Koeppe
committed
Merge branch 't/31132/homebrew__unused_packages__singular__pari_______in__usr_local_leak_into_build_when_using_homebrew_s_python3' into t/31180/add_snappy_as_a_pip_package
2 parents c8583bb + ee679bd commit fb5366d

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

build/pkgs/python3/spkg-configure.m4

Lines changed: 17 additions & 7 deletions
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,17 +48,24 @@ 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
])

m4/sage_check_python_for_venv.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ modules = list((Extension("config_check_distutils_cxx", list(("conftest.cpp",)),
107107
setup(name="config_check_distutils_cxx", ext_modules=modules)
108108
exit(0)
109109
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], [
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], [
112112
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])
113113
])
114114
], [

0 commit comments

Comments
 (0)