Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
144 changes: 144 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def detect_simple_extensions(self):
# 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
Expand Down Expand Up @@ -1432,11 +1432,12 @@ def detect_expat_elementtree(self):

def detect_multibytecodecs(self):
# Hye-Shik Chang's CJKCodecs modules.
self.add(Extension('_multibytecodec',
['cjkcodecs/multibytecodec.c']))
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
Expand Down