bpo-45847: Port codecs and unicodedata to PY_STDLIB_MOD (GH-29685)

This commit is contained in:
Christian Heimes 2021-11-21 15:08:47 +02:00 committed by GitHub
parent f201d261cf
commit 2afa1a1266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 5 deletions

View File

@ -56,6 +56,14 @@
# _elementtree libexpat via CAPI hook in pyexpat.
@MODULE__ELEMENTTREE_TRUE@_elementtree _elementtree.c
@MODULE__CODECS_CN_TRUE@_codecs_cn cjkcodecs/_codecs_cn.c
@MODULE__CODECS_HK_TRUE@_codecs_hk cjkcodecs/_codecs_hk.c
@MODULE__CODECS_ISO2022_TRUE@_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
@MODULE__CODECS_JP_TRUE@_codecs_jp cjkcodecs/_codecs_jp.c
@MODULE__CODECS_KR_TRUE@_codecs_kr cjkcodecs/_codecs_kr.c
@MODULE__CODECS_TW_TRUE@_codecs_tw cjkcodecs/_codecs_tw.c
@MODULE__MULTIBYTECODEC_TRUE@_multibytecodec cjkcodecs/multibytecodec.c
@MODULE_UNICODEDATA_TRUE@unicodedata unicodedata.c
############################################################################
# Modules with some UNIX dependencies

144
configure vendored
View File

@ -654,6 +654,22 @@ MODULE__SHA1_FALSE
MODULE__SHA1_TRUE
MODULE__MD5_FALSE
MODULE__MD5_TRUE
MODULE_UNICODEDATA_FALSE
MODULE_UNICODEDATA_TRUE
MODULE__MULTIBYTECODEC_FALSE
MODULE__MULTIBYTECODEC_TRUE
MODULE__CODECS_TW_FALSE
MODULE__CODECS_TW_TRUE
MODULE__CODECS_KR_FALSE
MODULE__CODECS_KR_TRUE
MODULE__CODECS_JP_FALSE
MODULE__CODECS_JP_TRUE
MODULE__CODECS_ISO2022_FALSE
MODULE__CODECS_ISO2022_TRUE
MODULE__CODECS_HK_FALSE
MODULE__CODECS_HK_TRUE
MODULE__CODECS_CN_FALSE
MODULE__CODECS_CN_TRUE
MODULE__ELEMENTTREE_FALSE
MODULE__ELEMENTTREE_TRUE
MODULE_PYEXPAT_FALSE
@ -19913,6 +19929,102 @@ fi
$as_echo "$py_cv_module__elementtree" >&6; }
if true; then
MODULE__CODECS_CN_TRUE=
MODULE__CODECS_CN_FALSE='#'
else
MODULE__CODECS_CN_TRUE='#'
MODULE__CODECS_CN_FALSE=
fi
if true; then
MODULE__CODECS_HK_TRUE=
MODULE__CODECS_HK_FALSE='#'
else
MODULE__CODECS_HK_TRUE='#'
MODULE__CODECS_HK_FALSE=
fi
if true; then
MODULE__CODECS_ISO2022_TRUE=
MODULE__CODECS_ISO2022_FALSE='#'
else
MODULE__CODECS_ISO2022_TRUE='#'
MODULE__CODECS_ISO2022_FALSE=
fi
if true; then
MODULE__CODECS_JP_TRUE=
MODULE__CODECS_JP_FALSE='#'
else
MODULE__CODECS_JP_TRUE='#'
MODULE__CODECS_JP_FALSE=
fi
if true; then
MODULE__CODECS_KR_TRUE=
MODULE__CODECS_KR_FALSE='#'
else
MODULE__CODECS_KR_TRUE='#'
MODULE__CODECS_KR_FALSE=
fi
if true; then
MODULE__CODECS_TW_TRUE=
MODULE__CODECS_TW_FALSE='#'
else
MODULE__CODECS_TW_TRUE='#'
MODULE__CODECS_TW_FALSE=
fi
if true; then
MODULE__MULTIBYTECODEC_TRUE=
MODULE__MULTIBYTECODEC_FALSE='#'
else
MODULE__MULTIBYTECODEC_TRUE='#'
MODULE__MULTIBYTECODEC_FALSE=
fi
if true; then
MODULE_UNICODEDATA_TRUE=
MODULE_UNICODEDATA_FALSE='#'
else
MODULE_UNICODEDATA_TRUE='#'
MODULE_UNICODEDATA_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _md5" >&5
$as_echo_n "checking for stdlib extension module _md5... " >&6; }
@ -20669,6 +20781,38 @@ 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__CODECS_CN_TRUE}" && test -z "${MODULE__CODECS_CN_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CODECS_CN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__CODECS_HK_TRUE}" && test -z "${MODULE__CODECS_HK_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CODECS_HK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__CODECS_ISO2022_TRUE}" && test -z "${MODULE__CODECS_ISO2022_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CODECS_ISO2022\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__CODECS_JP_TRUE}" && test -z "${MODULE__CODECS_JP_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CODECS_JP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__CODECS_KR_TRUE}" && test -z "${MODULE__CODECS_KR_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CODECS_KR\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__CODECS_TW_TRUE}" && test -z "${MODULE__CODECS_TW_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CODECS_TW\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__MULTIBYTECODEC_TRUE}" && test -z "${MODULE__MULTIBYTECODEC_FALSE}"; then
as_fn_error $? "conditional \"MODULE__MULTIBYTECODEC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_UNICODEDATA_TRUE}" && test -z "${MODULE_UNICODEDATA_FALSE}"; then
as_fn_error $? "conditional \"MODULE_UNICODEDATA\" 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

View File

@ -6074,6 +6074,14 @@ PY_STDLIB_MOD([termios], [], [test "$ac_cv_header_termios_h" = yes])
dnl _elementtree loads libexpat via CAPI hook in pyexpat
PY_STDLIB_MOD([pyexpat], [], [], [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
PY_STDLIB_MOD([_elementtree], [], [], [$LIBEXPAT_CFLAGS], [])
PY_STDLIB_MOD_SIMPLE([_codecs_cn])
PY_STDLIB_MOD_SIMPLE([_codecs_hk])
PY_STDLIB_MOD_SIMPLE([_codecs_iso2022])
PY_STDLIB_MOD_SIMPLE([_codecs_jp])
PY_STDLIB_MOD_SIMPLE([_codecs_kr])
PY_STDLIB_MOD_SIMPLE([_codecs_tw])
PY_STDLIB_MOD_SIMPLE([_multibytecodec])
PY_STDLIB_MOD_SIMPLE([unicodedata])
dnl By default we always compile these even when OpenSSL is available
dnl (issue #14693). The modules are small.

View File

@ -1022,7 +1022,7 @@ class PyBuildExt(build_ext):
# profiler (_lsprof is for cProfile.py)
self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']))
# static Unicode character database
self.add(Extension('unicodedata', ['unicodedata.c']))
self.addext(Extension('unicodedata', ['unicodedata.c']))
# _opcode module
self.add(Extension('_opcode', ['_opcode.c']))
# asyncio speedups
@ -1432,11 +1432,12 @@ class PyBuildExt(build_ext):
def detect_multibytecodecs(self):
# Hye-Shik Chang's CJKCodecs modules.
self.add(Extension('_multibytecodec',
self.addext(Extension('_multibytecodec',
['cjkcodecs/multibytecodec.c']))
for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'):
self.add(Extension('_codecs_%s' % loc,
['cjkcodecs/_codecs_%s.c' % loc]))
self.addext(Extension(
f'_codecs_{loc}', [f'cjkcodecs/_codecs_{loc}.c']
))
def detect_multiprocessing(self):
# Richard Oudkerk's multiprocessing module