mirror of https://github.com/python/cpython
bpo-45847: Port builtin hashlib extensions to PY_STDLIB_MOD (GH-29642)
This commit is contained in:
parent
e34809e1c2
commit
c8c21bdd19
|
@ -0,0 +1 @@
|
|||
Port builtin hashlib extensions to ``PY_STDLIB_MOD`` macro and ``addext()``.
|
|
@ -37,6 +37,13 @@
|
|||
# with ./configure --with-system-libmpdec
|
||||
@MODULE__DECIMAL_TRUE@_decimal _decimal/_decimal.c
|
||||
|
||||
# hashing builtins, can be disabled with --without-builtin-hashlib-hashes
|
||||
@MODULE__MD5_TRUE@_md5 md5module.c
|
||||
@MODULE__SHA1_TRUE@_sha1 sha1module.c
|
||||
@MODULE__SHA256_TRUE@_sha256 sha256module.c
|
||||
@MODULE__SHA512_TRUE@_sha512 sha512module.c
|
||||
@MODULE__SHA3_TRUE@_sha3 _sha3/sha3module.c
|
||||
@MODULE__BLAKE2_TRUE@_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
|
||||
|
||||
############################################################################
|
||||
# XML and text
|
||||
|
|
|
@ -628,6 +628,18 @@ MODULE__SQLITE3_FALSE
|
|||
MODULE__SQLITE3_TRUE
|
||||
MODULE__DECIMAL_FALSE
|
||||
MODULE__DECIMAL_TRUE
|
||||
MODULE__BLAKE2_FALSE
|
||||
MODULE__BLAKE2_TRUE
|
||||
MODULE__SHA3_FALSE
|
||||
MODULE__SHA3_TRUE
|
||||
MODULE__SHA512_FALSE
|
||||
MODULE__SHA512_TRUE
|
||||
MODULE__SHA256_FALSE
|
||||
MODULE__SHA256_TRUE
|
||||
MODULE__SHA1_FALSE
|
||||
MODULE__SHA1_TRUE
|
||||
MODULE__MD5_FALSE
|
||||
MODULE__MD5_TRUE
|
||||
MODULE__ELEMENTTREE_FALSE
|
||||
MODULE__ELEMENTTREE_TRUE
|
||||
MODULE_PYEXPAT_FALSE
|
||||
|
@ -19333,32 +19345,50 @@ $as_echo_n "checking for --with-builtin-hashlib-hashes... " >&6; }
|
|||
# Check whether --with-builtin-hashlib-hashes was given.
|
||||
if test "${with_builtin_hashlib_hashes+set}" = set; then :
|
||||
withval=$with_builtin_hashlib_hashes;
|
||||
case "$withval" in
|
||||
yes)
|
||||
withval=$default_hashlib_hashes
|
||||
;;
|
||||
no)
|
||||
withval=""
|
||||
;;
|
||||
case $with_builtin_hashlib_hashes in #(
|
||||
yes) :
|
||||
with_builtin_hashlib_hashes=$default_hashlib_hashes ;; #(
|
||||
no) :
|
||||
with_builtin_hashlib_hashes=""
|
||||
;; #(
|
||||
*) :
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
|
||||
$as_echo "$withval" >&6; }
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define PY_BUILTIN_HASHLIB_HASHES "$withval"
|
||||
_ACEOF
|
||||
|
||||
|
||||
else
|
||||
with_builtin_hashlib_hashes=$default_hashlib_hashes
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $default_hashlib_hashes" >&5
|
||||
$as_echo "$default_hashlib_hashes" >&6; };
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_builtin_hashlib_hashes" >&5
|
||||
$as_echo "$with_builtin_hashlib_hashes" >&6; }
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define PY_BUILTIN_HASHLIB_HASHES "$default_hashlib_hashes"
|
||||
#define PY_BUILTIN_HASHLIB_HASHES "$with_builtin_hashlib_hashes"
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
as_save_IFS=$IFS
|
||||
IFS=,
|
||||
for builtin_hash in $with_builtin_hashlib_hashes; do
|
||||
case $builtin_hash in #(
|
||||
md5) :
|
||||
with_builtin_md5=yes ;; #(
|
||||
sha1) :
|
||||
with_builtin_sha1=yes ;; #(
|
||||
sha256) :
|
||||
with_builtin_sha256=yes ;; #(
|
||||
sha512) :
|
||||
with_builtin_sha512=yes ;; #(
|
||||
sha3) :
|
||||
with_builtin_sha3=yes ;; #(
|
||||
blake2) :
|
||||
with_builtin_blake2=yes
|
||||
;; #(
|
||||
*) :
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
# --with-experimental-isolated-subinterpreters
|
||||
|
||||
|
@ -19660,6 +19690,307 @@ $as_echo "$py_cv_module__elementtree" >&6; }
|
|||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _md5" >&5
|
||||
$as_echo_n "checking for stdlib extension module _md5... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_md5*) :
|
||||
py_cv_module__md5=n/a ;; #(
|
||||
*) :
|
||||
|
||||
if test "$with_builtin_md5" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__md5=yes
|
||||
else
|
||||
py_cv_module__md5=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__md5=disabled
|
||||
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__MD5=$py_cv_module__md5$as_nl"
|
||||
if test "x$py_cv_module__md5" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__MD5_CFLAGS=$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__MD5_LDFLAGS=$as_nl"
|
||||
if true; then
|
||||
MODULE__MD5_TRUE=
|
||||
MODULE__MD5_FALSE='#'
|
||||
else
|
||||
MODULE__MD5_TRUE='#'
|
||||
MODULE__MD5_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
if false; then
|
||||
MODULE__MD5_TRUE=
|
||||
MODULE__MD5_FALSE='#'
|
||||
else
|
||||
MODULE__MD5_TRUE='#'
|
||||
MODULE__MD5_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__md5" >&5
|
||||
$as_echo "$py_cv_module__md5" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha1" >&5
|
||||
$as_echo_n "checking for stdlib extension module _sha1... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_sha1*) :
|
||||
py_cv_module__sha1=n/a ;; #(
|
||||
*) :
|
||||
|
||||
if test "$with_builtin_sha1" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__sha1=yes
|
||||
else
|
||||
py_cv_module__sha1=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__sha1=disabled
|
||||
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA1=$py_cv_module__sha1$as_nl"
|
||||
if test "x$py_cv_module__sha1" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA1_CFLAGS=$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA1_LDFLAGS=$as_nl"
|
||||
if true; then
|
||||
MODULE__SHA1_TRUE=
|
||||
MODULE__SHA1_FALSE='#'
|
||||
else
|
||||
MODULE__SHA1_TRUE='#'
|
||||
MODULE__SHA1_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
if false; then
|
||||
MODULE__SHA1_TRUE=
|
||||
MODULE__SHA1_FALSE='#'
|
||||
else
|
||||
MODULE__SHA1_TRUE='#'
|
||||
MODULE__SHA1_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha1" >&5
|
||||
$as_echo "$py_cv_module__sha1" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha256" >&5
|
||||
$as_echo_n "checking for stdlib extension module _sha256... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_sha256*) :
|
||||
py_cv_module__sha256=n/a ;; #(
|
||||
*) :
|
||||
|
||||
if test "$with_builtin_sha256" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__sha256=yes
|
||||
else
|
||||
py_cv_module__sha256=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__sha256=disabled
|
||||
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA256=$py_cv_module__sha256$as_nl"
|
||||
if test "x$py_cv_module__sha256" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA256_CFLAGS=$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA256_LDFLAGS=$as_nl"
|
||||
if true; then
|
||||
MODULE__SHA256_TRUE=
|
||||
MODULE__SHA256_FALSE='#'
|
||||
else
|
||||
MODULE__SHA256_TRUE='#'
|
||||
MODULE__SHA256_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
if false; then
|
||||
MODULE__SHA256_TRUE=
|
||||
MODULE__SHA256_FALSE='#'
|
||||
else
|
||||
MODULE__SHA256_TRUE='#'
|
||||
MODULE__SHA256_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha256" >&5
|
||||
$as_echo "$py_cv_module__sha256" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha512" >&5
|
||||
$as_echo_n "checking for stdlib extension module _sha512... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_sha512*) :
|
||||
py_cv_module__sha512=n/a ;; #(
|
||||
*) :
|
||||
|
||||
if test "$with_builtin_sha512" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__sha512=yes
|
||||
else
|
||||
py_cv_module__sha512=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__sha512=disabled
|
||||
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA512=$py_cv_module__sha512$as_nl"
|
||||
if test "x$py_cv_module__sha512" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA512_CFLAGS=$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA512_LDFLAGS=$as_nl"
|
||||
if true; then
|
||||
MODULE__SHA512_TRUE=
|
||||
MODULE__SHA512_FALSE='#'
|
||||
else
|
||||
MODULE__SHA512_TRUE='#'
|
||||
MODULE__SHA512_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
if false; then
|
||||
MODULE__SHA512_TRUE=
|
||||
MODULE__SHA512_FALSE='#'
|
||||
else
|
||||
MODULE__SHA512_TRUE='#'
|
||||
MODULE__SHA512_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha512" >&5
|
||||
$as_echo "$py_cv_module__sha512" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha3" >&5
|
||||
$as_echo_n "checking for stdlib extension module _sha3... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_sha3*) :
|
||||
py_cv_module__sha3=n/a ;; #(
|
||||
*) :
|
||||
|
||||
if test "$with_builtin_sha3" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__sha3=yes
|
||||
else
|
||||
py_cv_module__sha3=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__sha3=disabled
|
||||
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA3=$py_cv_module__sha3$as_nl"
|
||||
if test "x$py_cv_module__sha3" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA3_CFLAGS=$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__SHA3_LDFLAGS=$as_nl"
|
||||
if true; then
|
||||
MODULE__SHA3_TRUE=
|
||||
MODULE__SHA3_FALSE='#'
|
||||
else
|
||||
MODULE__SHA3_TRUE='#'
|
||||
MODULE__SHA3_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
if false; then
|
||||
MODULE__SHA3_TRUE=
|
||||
MODULE__SHA3_FALSE='#'
|
||||
else
|
||||
MODULE__SHA3_TRUE='#'
|
||||
MODULE__SHA3_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha3" >&5
|
||||
$as_echo "$py_cv_module__sha3" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _blake2" >&5
|
||||
$as_echo_n "checking for stdlib extension module _blake2... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_blake2*) :
|
||||
py_cv_module__blake2=n/a ;; #(
|
||||
*) :
|
||||
|
||||
if test "$with_builtin_blake2" = yes; then :
|
||||
if true; then :
|
||||
py_cv_module__blake2=yes
|
||||
else
|
||||
py_cv_module__blake2=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__blake2=disabled
|
||||
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__BLAKE2=$py_cv_module__blake2$as_nl"
|
||||
if test "x$py_cv_module__blake2" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__BLAKE2_CFLAGS=$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__BLAKE2_LDFLAGS=$as_nl"
|
||||
if true; then
|
||||
MODULE__BLAKE2_TRUE=
|
||||
MODULE__BLAKE2_FALSE='#'
|
||||
else
|
||||
MODULE__BLAKE2_TRUE='#'
|
||||
MODULE__BLAKE2_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
if false; then
|
||||
MODULE__BLAKE2_TRUE=
|
||||
MODULE__BLAKE2_FALSE='#'
|
||||
else
|
||||
MODULE__BLAKE2_TRUE='#'
|
||||
MODULE__BLAKE2_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__blake2" >&5
|
||||
$as_echo "$py_cv_module__blake2" >&6; }
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _decimal" >&5
|
||||
$as_echo_n "checking for stdlib extension module _decimal... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
|
@ -19916,6 +20247,54 @@ if test -z "${MODULE__ELEMENTTREE_TRUE}" && test -z "${MODULE__ELEMENTTREE_FALSE
|
|||
as_fn_error $? "conditional \"MODULE__ELEMENTTREE\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__MD5_TRUE}" && test -z "${MODULE__MD5_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__MD5\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__MD5_TRUE}" && test -z "${MODULE__MD5_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__MD5\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA1_TRUE}" && test -z "${MODULE__SHA1_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA1\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA1_TRUE}" && test -z "${MODULE__SHA1_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA1\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA256_TRUE}" && test -z "${MODULE__SHA256_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA256\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA256_TRUE}" && test -z "${MODULE__SHA256_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA256\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA512_TRUE}" && test -z "${MODULE__SHA512_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA512\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA512_TRUE}" && test -z "${MODULE__SHA512_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA512\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA3_TRUE}" && test -z "${MODULE__SHA3_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA3\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__SHA3_TRUE}" && test -z "${MODULE__SHA3_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__SHA3\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__BLAKE2_TRUE}" && test -z "${MODULE__BLAKE2_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__BLAKE2\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__BLAKE2_TRUE}" && test -z "${MODULE__BLAKE2_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__BLAKE2\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
|
|
46
configure.ac
46
configure.ac
|
@ -5902,21 +5902,28 @@ AC_ARG_WITH(builtin-hashlib-hashes,
|
|||
[builtin hash modules,
|
||||
md5, sha1, sha256, sha512, sha3 (with shake), blake2]),
|
||||
[
|
||||
case "$withval" in
|
||||
yes)
|
||||
withval=$default_hashlib_hashes
|
||||
;;
|
||||
no)
|
||||
withval=""
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT($withval)
|
||||
AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$withval")
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT($default_hashlib_hashes);
|
||||
AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$default_hashlib_hashes")
|
||||
])
|
||||
AS_CASE([$with_builtin_hashlib_hashes],
|
||||
[yes], [with_builtin_hashlib_hashes=$default_hashlib_hashes],
|
||||
[no], [with_builtin_hashlib_hashes=""]
|
||||
)
|
||||
], [with_builtin_hashlib_hashes=$default_hashlib_hashes])
|
||||
|
||||
AC_MSG_RESULT($with_builtin_hashlib_hashes)
|
||||
AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$with_builtin_hashlib_hashes")
|
||||
|
||||
as_save_IFS=$IFS
|
||||
IFS=,
|
||||
for builtin_hash in $with_builtin_hashlib_hashes; do
|
||||
AS_CASE($builtin_hash,
|
||||
[md5], [with_builtin_md5=yes],
|
||||
[sha1], [with_builtin_sha1=yes],
|
||||
[sha256], [with_builtin_sha256=yes],
|
||||
[sha512], [with_builtin_sha512=yes],
|
||||
[sha3], [with_builtin_sha3=yes],
|
||||
[blake2], [with_builtin_blake2=yes]
|
||||
)
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
# --with-experimental-isolated-subinterpreters
|
||||
AH_TEMPLATE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS,
|
||||
|
@ -6060,6 +6067,15 @@ dnl _elementtree loads libexpat via CAPI hook in pyexpat
|
|||
PY_STDLIB_MOD([pyexpat], [], [], [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
|
||||
PY_STDLIB_MOD([_elementtree], [], [], [$LIBEXPAT_CFLAGS], [])
|
||||
|
||||
dnl By default we always compile these even when OpenSSL is available
|
||||
dnl (issue #14693). The modules are small.
|
||||
PY_STDLIB_MOD([_md5], [test "$with_builtin_md5" = yes])
|
||||
PY_STDLIB_MOD([_sha1], [test "$with_builtin_sha1" = yes])
|
||||
PY_STDLIB_MOD([_sha256], [test "$with_builtin_sha256" = yes])
|
||||
PY_STDLIB_MOD([_sha512], [test "$with_builtin_sha512" = yes])
|
||||
PY_STDLIB_MOD([_sha3], [test "$with_builtin_sha3" = yes])
|
||||
PY_STDLIB_MOD([_blake2], [test "$with_builtin_blake2" = yes])
|
||||
|
||||
PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS])
|
||||
PY_STDLIB_MOD([_sqlite3],
|
||||
[test "$have_sqlite3" = "yes"],
|
||||
|
|
58
setup.py
58
setup.py
|
@ -2034,53 +2034,19 @@ class PyBuildExt(build_ext):
|
|||
# (issue #14693). It's harmless and the object code is tiny
|
||||
# (40-50 KiB per module, only loaded when actually used). Modules can
|
||||
# be disabled via the --with-builtin-hashlib-hashes configure flag.
|
||||
supported = {"md5", "sha1", "sha256", "sha512", "sha3", "blake2"}
|
||||
|
||||
configured = sysconfig.get_config_var("PY_BUILTIN_HASHLIB_HASHES")
|
||||
configured = configured.strip('"').lower()
|
||||
configured = {
|
||||
m.strip() for m in configured.split(",")
|
||||
}
|
||||
|
||||
self.disabled_configure.extend(
|
||||
sorted(supported.difference(configured))
|
||||
)
|
||||
|
||||
if "sha256" in configured:
|
||||
self.add(Extension(
|
||||
'_sha256', ['sha256module.c']
|
||||
))
|
||||
|
||||
if "sha512" in configured:
|
||||
self.add(Extension(
|
||||
'_sha512', ['sha512module.c'],
|
||||
))
|
||||
|
||||
if "md5" in configured:
|
||||
self.add(Extension(
|
||||
'_md5', ['md5module.c'],
|
||||
))
|
||||
|
||||
if "sha1" in configured:
|
||||
self.add(Extension(
|
||||
'_sha1', ['sha1module.c'],
|
||||
))
|
||||
|
||||
if "blake2" in configured:
|
||||
self.add(Extension(
|
||||
'_blake2',
|
||||
[
|
||||
'_blake2/blake2module.c',
|
||||
'_blake2/blake2b_impl.c',
|
||||
'_blake2/blake2s_impl.c'
|
||||
]
|
||||
))
|
||||
|
||||
if "sha3" in configured:
|
||||
self.add(Extension(
|
||||
'_sha3',
|
||||
['_sha3/sha3module.c'],
|
||||
))
|
||||
self.addext(Extension('_md5', ['md5module.c']))
|
||||
self.addext(Extension('_sha1', ['sha1module.c']))
|
||||
self.addext(Extension('_sha256', ['sha256module.c']))
|
||||
self.addext(Extension('_sha512', ['sha512module.c']))
|
||||
self.addext(Extension('_sha3', ['_sha3/sha3module.c']))
|
||||
self.addext(Extension('_blake2',
|
||||
[
|
||||
'_blake2/blake2module.c',
|
||||
'_blake2/blake2b_impl.c',
|
||||
'_blake2/blake2s_impl.c'
|
||||
]
|
||||
))
|
||||
|
||||
def detect_nis(self):
|
||||
if MS_WINDOWS or CYGWIN or HOST_PLATFORM == 'qnx6':
|
||||
|
|
Loading…
Reference in New Issue