from test.support import threading_helper
-requires_fork = unittest.skipUnless(hasattr(os, 'fork'),
+requires_fork = unittest.skipUnless(support.has_fork_support,
"platform doesn't support fork "
"(no _at_fork_reinit method)")
import re
import sys
import traceback
+import unittest
import warnings
def collect_test_socket(info_add):
try:
from test import test_socket
- except ImportError:
+ except (ImportError, unittest.SkipTest):
return
# all check attributes like HAVE_SOCKET_CAN
"requires_IEEE_754", "requires_zlib",
"has_fork_support", "requires_fork",
"has_subprocess_support", "requires_subprocess",
+ "has_socket_support", "requires_working_socket",
"anticipate_failure", "load_package_tests", "detect_api_mismatch",
"check__all__", "skip_if_buggy_ucrt_strfptime",
"check_disallow_instantiation", "check_sanitizer", "skip_if_sanitizer",
"""Used for subprocess, os.spawn calls, fd inheritance"""
return unittest.skipUnless(has_subprocess_support, "requires subprocess support")
+# Emscripten's socket emulation has limitation. WASI doesn't have sockets yet.
+has_socket_support = not is_emscripten and not is_wasi
+
+def requires_working_socket(*, module=False):
+ """Skip tests or modules that require working sockets
+
+ Can be used as a function/class decorator or to skip an entire module.
+ """
+ msg = "requires socket support"
+ if module:
+ if not has_socket_support:
+ raise unittest.SkipTest(msg)
+ else:
+ return unittest.skipUnless(has_socket_support, msg)
+
# Does strftime() support glibc extension like '%4Y'?
has_strftime_extensions = False
if sys.platform != "win32":
import contextlib
from test.support.import_helper import import_module
-from test.support import gc_collect
+from test.support import gc_collect, requires_working_socket
asyncio = import_module("asyncio")
+requires_working_socket(module=True)
+
_no_default = object()
import asynchat
import asyncore
+support.requires_working_socket(module=True)
+
HOST = socket_helper.HOST
SERVER_QUIT = b'QUIT\n'
import os
+from test import support
from test.support import load_package_tests
from test.support import import_helper
+support.requires_working_socket(module=True)
# Skip tests if we don't have concurrent.futures.
import_helper.import_module('concurrent.futures')
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
+support.requires_working_socket(module=True)
+
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
from test.test_contextlib import TestBaseExitStack
+support.requires_working_socket(module=True)
def _async_test(func):
"""Decorator to turn an async function into a test case."""
import types
import contextlib
+
+if not support.has_subprocess_support:
+ raise unittest.SkipTest("test_CLI requires subprocess support.")
+
+
# NOTE: There are some additional tests relating to interaction with
# zipimport in the test_zipimport_support test module.
>>> tests = finder.find(sample_func)
>>> print(tests) # doctest: +ELLIPSIS
- [<DocTest sample_func from test_doctest.py:28 (1 example)>]
+ [<DocTest sample_func from test_doctest.py:33 (1 example)>]
The exact name depends on how test_doctest was invoked, so allow for
leading path components.
import sys
import threading
import unittest
+from test import support
+
+support.requires_working_socket(module=True)
def make_request_and_skipIf(condition, reason):
# If we skip the test, we have to make a request because
import asyncore
import asynchat
+support.requires_working_socket(module=True)
TIMEOUT = support.LOOPBACK_TIMEOUT
DEFAULT_ENCODING = 'utf-8'
from test.support import socket_helper
from test.support import warnings_helper
+support.requires_working_socket(module=True)
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
from test.support import os_helper
from test.support import threading_helper
+support.requires_working_socket(module=True)
class NoLogRequestHandler:
def log_message(self, *args):
import socket
from test.support import (verbose,
- run_with_tz, run_with_locale, cpython_only)
+ run_with_tz, run_with_locale, cpython_only,
+ requires_working_socket)
from test.support import hashlib_helper
from test.support import threading_helper
from test.support import warnings_helper
except ImportError:
ssl = None
+support.requires_working_socket(module=True)
+
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert3.pem")
CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "pycacert.pem")
from test.support import os_helper
from test.support import (
- STDLIB_DIR, is_jython, swap_attr, swap_item, cpython_only)
+ STDLIB_DIR, is_jython, swap_attr, swap_item, cpython_only, is_emscripten)
from test.support.import_helper import (
forget, make_legacy_pyc, unlink, unload, DirsOnSysPath, CleanImport)
from test.support.os_helper import (
with self.assertRaises(ImportError) as cm:
from _testcapi import i_dont_exist
self.assertEqual(cm.exception.name, '_testcapi')
- self.assertEqual(cm.exception.path, _testcapi.__file__)
- self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|pyd)\)")
+ if hasattr(_testcapi, "__file__"):
+ self.assertEqual(cm.exception.path, _testcapi.__file__)
+ self.assertRegex(
+ str(cm.exception),
+ r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|pyd)\)"
+ )
+ else:
+ self.assertEqual(
+ str(cm.exception),
+ "cannot import name 'i_dont_exist' from '_testcapi' (unknown location)"
+ )
def test_from_import_missing_attr_has_name(self):
with self.assertRaises(ImportError) as cm:
@unittest.skipUnless(os.name == 'posix',
"test meaningful only on posix systems")
+ @unittest.skipIf(is_emscripten, "Emscripten's umask is a stub.")
def test_creation_mode(self):
mask = 0o022
with temp_umask(mask), _ready_to_import() as (name, path):
"""Test the finder for extension modules."""
+ def setUp(self):
+ if not self.machinery.EXTENSION_SUFFIXES:
+ raise unittest.SkipTest("Requires dynamic loading support.")
+
def find_spec(self, fullname):
importer = self.machinery.FileFinder(util.EXTENSIONS.path,
(self.machinery.ExtensionFileLoader,
import importlib
from test.support.script_helper import assert_python_failure
+
class LoaderTests(abc.LoaderTests):
"""Test load_module() for extension modules."""
def setUp(self):
+ if not self.machinery.EXTENSION_SUFFIXES:
+ raise unittest.SkipTest("Requires dynamic loading support.")
self.loader = self.machinery.ExtensionFileLoader(util.EXTENSIONS.name,
util.EXTENSIONS.file_path)
# Test loading extension modules with multi-phase initialization (PEP 489).
def setUp(self):
+ if not self.machinery.EXTENSION_SUFFIXES:
+ raise unittest.SkipTest("Requires dynamic loading support.")
self.name = '_testmultiphase'
finder = self.machinery.FileFinder(None)
self.spec = importlib.util.find_spec(self.name)
from test.support.script_helper import assert_python_ok
+@support.requires_subprocess()
class TestTool(unittest.TestCase):
data = """
except ImportError:
pass
+
class BaseTest(unittest.TestCase):
"""Base class for logging tests."""
os.unlink(fn)
@unittest.skipIf(os.name == 'nt', 'WatchedFileHandler not appropriate for Windows.')
+ @unittest.skipIf(
+ support.is_emscripten, "Emscripten cannot fstat unlinked files."
+ )
def test_race(self):
# Issue #14632 refers.
def remove_loop(fname, tries):
# - end of server_helper section
+@support.requires_working_socket()
class SMTPHandlerTest(BaseTest):
# bpo-14314, bpo-19665, bpo-34092: don't wait forever
TIMEOUT = support.LONG_TIMEOUT
os.unlink(fn)
+@support.requires_working_socket()
class SocketHandlerTest(BaseTest):
"""Test for SocketHandler objects."""
SocketHandlerTest.tearDown(self)
os_helper.unlink(self.address)
+@support.requires_working_socket()
class DatagramHandlerTest(BaseTest):
"""Test for DatagramHandler."""
DatagramHandlerTest.tearDown(self)
os_helper.unlink(self.address)
+@support.requires_working_socket()
class SysLogHandlerTest(BaseTest):
"""Test for SysLogHandler using UDP."""
self.server_class.address_family = socket.AF_INET
super(IPv6SysLogHandlerTest, self).tearDown()
+@support.requires_working_socket()
class HTTPHandlerTest(BaseTest):
"""Test for HTTPHandler."""
logging.config.stopListening()
threading_helper.join_thread(t)
+ @support.requires_working_socket()
def test_listen_config_10_ok(self):
with support.captured_stdout() as output:
self.setup_via_listener(json.dumps(self.config10))
('ERROR', '4'),
], stream=output)
+ @support.requires_working_socket()
def test_listen_config_1_ok(self):
with support.captured_stdout() as output:
self.setup_via_listener(textwrap.dedent(ConfigFileTest.config1))
# Original logger output is empty.
self.assert_log_lines([])
+ @support.requires_working_socket()
def test_listen_verify(self):
def verify_fail(stuff):
self.assertEqual(contents, f.read())
self._box = self._factory(self._path)
- @unittest.skipUnless(hasattr(os, 'fork'), "Test needs fork().")
+ @support.requires_fork()
@unittest.skipUnless(hasattr(socket, 'socketpair'), "Test needs socketpair().")
def test_lock_conflict(self):
# Fork off a child process that will lock the mailbox temporarily,
-from test.support import (requires, _2G, _4G, gc_collect, cpython_only)
+from test.support import (
+ requires, _2G, _4G, gc_collect, cpython_only, is_emscripten
+)
from test.support.import_helper import import_module
from test.support.os_helper import TESTFN, unlink
import unittest
suffix = ''.join(random.choices(string.ascii_uppercase, k=length))
return f'{tagname_prefix}_{suffix}'
+# Python's mmap module dup()s the file descriptor. Emscripten's FS layer
+# does not materialize file changes through a dupped fd to a new mmap.
+if is_emscripten:
+ raise unittest.SkipTest("incompatible with Emscripten's mmap emulation.")
+
+
class MmapTests(unittest.TestCase):
def setUp(self):
from contextlib import ExitStack, redirect_stdout
from io import StringIO
+from test import support
from test.support import os_helper
# This little helper class is essential for testing pdb under doctest.
from test.test_doctest import _FakeInput
"""
+@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):
def tearDown(self):
os_helper.unlink(os_helper.TESTFN)
"""
+@support.requires_subprocess()
class TestCParser(unittest.TestCase):
def setUp(self):
self._backup_config_vars = dict(sysconfig._CONFIG_VARS)
# parent
support.wait_process(pid, exitcode=0)
+ @unittest.skipIf(support.is_emscripten, "Does not apply to Emscripten")
def test_libc_ver(self):
# check that libc_ver(executable) doesn't raise an exception
if os.path.isdir(sys.executable) and \
import threading
import time
import unittest
-from test.support import cpython_only, requires_subprocess
+from test.support import (
+ cpython_only, requires_subprocess, requires_working_socket
+)
from test.support import threading_helper
from test.support.os_helper import TESTFN
except AttributeError:
raise unittest.SkipTest("select.poll not defined")
+requires_working_socket(module=True)
def find_ready_matching(ready, flag):
match = []
import asynchat
import asyncore
+test_support.requires_working_socket(module=True)
+
HOST = socket_helper.HOST
PORT = 0
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support import threading_helper
from test.support import (reap_children, captured_output, captured_stdout,
- captured_stderr, requires_docstrings)
+ captured_stderr, is_emscripten, requires_docstrings)
from test.support.os_helper import (TESTFN, rmtree, unlink)
from test import pydoc_mod
)
+@unittest.skipIf(is_emscripten, "Socket server not available on Emscripten.")
class PydocServerTest(unittest.TestCase):
"""Tests for pydoc._start_server"""
pass
+@unittest.skipIf(
+ support.is_emscripten, "Socket server not available on Emscripten."
+)
class PasswordProtectedSiteTestCase(unittest.TestCase):
def setUp(self):
import unittest
from test import support
+support.requires_working_socket(module=True)
+
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
resource = None
+if support.is_emscripten:
+ raise unittest.SkipTest("Cannot create socketpair on Emscripten.")
+
+
if hasattr(socket, 'socketpair'):
socketpair = socket.socketpair
else:
import asyncore
import smtpd
+support.requires_working_socket(module=True)
+
HOST = socket_helper.HOST
if sys.platform == 'darwin':
except ImportError:
fcntl = None
+support.requires_working_socket(module=True)
+
HOST = socket_helper.HOST
# test unicode string and carriage return
MSG = 'Michael Gilfix was here\u1234\r\n'.encode('utf-8')
HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")
requires_unix_sockets = unittest.skipUnless(HAVE_UNIX_SOCKETS,
'requires Unix sockets')
-HAVE_FORKING = hasattr(os, "fork")
+HAVE_FORKING = test.support.has_fork_support
requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
def signal_alarm(n):
from functools import wraps
import asyncio
+support.requires_working_socket(module=True)
class tracecontext:
"""Context manager that traces its enter and exit."""
from test.support import socket_helper
import unittest
+support.requires_working_socket(module=True)
+
HOST = socket_helper.HOST
def server(evt, serv):
raise unittest.SkipTest("test too slow on ASAN/MSAN build")
+if not support.has_subprocess_support:
+ raise unittest.SkipTest("test module requires subprocess")
+
+
basepath = os.path.normpath(
os.path.dirname( # <src/install dir>
os.path.dirname( # Lib
import urllib.error
import http.client
+support.requires_working_socket(module=True)
+
# XXX
# Request
# CacheFTPHandler (hard to write)
import unittest
import hashlib
+from test import support
from test.support import hashlib_helper
from test.support import threading_helper
from test.support import warnings_helper
except ImportError:
ssl = None
+support.requires_working_socket(module=True)
+
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
CERT_localhost = os.path.join(here, 'keycert.pem')
import tempfile
from test.support import (captured_stdout, captured_stderr, requires_zlib,
skip_if_broken_multiprocessing_synchronize, verbose,
- requires_subprocess)
+ requires_subprocess, is_emscripten)
from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree)
import unittest
import venv
or sys._base_executable != sys.executable,
'cannot run venv.create from within a venv on this platform')
+if is_emscripten:
+ raise unittest.SkipTest("venv is not available on Emscripten.")
+
@requires_subprocess()
def check_output(cmd, encoding=None):
p = subprocess.Popen(cmd,
from test.fork_wait import ForkWait
from test import support
-if not hasattr(os, 'fork'):
- raise unittest.SkipTest("os.fork not defined")
+if not support.has_fork_support:
+ raise unittest.SkipTest("requires working os.fork()")
if not hasattr(os, 'wait3'):
raise unittest.SkipTest("os.wait3 not defined")
from test import support
# If either of these do not exist, skip this test.
-support.get_attribute(os, 'fork')
+if not support.has_fork_support:
+ raise unittest.SkipTest("requires working os.fork()")
+
support.get_attribute(os, 'wait4')
except ImportError:
gzip = None
+support.requires_working_socket(module=True)
+
alist = [{'astring': 'foo@bar.baz.spam',
'afloat': 7283.43,
'anint': 2**20,
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "unittest.test." + fn[:-3]
- __import__(modname)
+ try:
+ __import__(modname)
+ except unittest.SkipTest:
+ continue
module = sys.modules[modname]
suite.addTest(loader.loadTestsFromModule(module))
suite.addTest(loader.loadTestsFromName('unittest.test.testmock'))
import unittest
from test import support
+support.requires_working_socket(module=True)
+
class MyException(Exception):
pass
return RESULT
+@support.requires_subprocess()
class TestCommandLineArgs(unittest.TestCase):
def setUp(self):
import sys
import pickle
import subprocess
+from test import support
import unittest
from unittest.case import _Outcome
expectedresult = (runner.stream, DESCRIPTIONS, VERBOSITY)
self.assertEqual(runner._makeResult(), expectedresult)
+ @support.requires_subprocess()
def test_warnings(self):
"""
Check that warnings argument of TextTestRunner correctly affects the
import re
import unittest
from contextlib import contextmanager
+from test import support
+
+support.requires_working_socket(module=True)
from asyncio import run, iscoroutinefunction
from unittest import IsolatedAsyncioTestCase
-rm -f pybuilddir.txt
-rm -f Lib/lib2to3/*Grammar*.pickle
-rm -f _bootstrap_python
- -rm -f python.html python*.js python.data
+ -rm -f python.html python*.js python.data python*.symbols python*.map
-rm -rf $(WASM_STDLIB)
-rm -f Programs/_testembed Programs/_freeze_module
-rm -f Python/deepfreeze/*.[co]
--- /dev/null
+The test suite is now passing on the Emscripten platform. All fork, socket,
+and subprocess-based tests are skipped.
;;
esac
;;
+ *emcc*)
+ if test "$Py_LTO_POLICY" != "default"; then
+ as_fn_error $? "emcc supports only default lto." "$LINENO" 5
+ fi
+ LTOFLAGS="-flto"
+ LTOCFLAGS="-flto"
+ ;;
*gcc*)
if test $Py_LTO_POLICY = thin
then
fi
# WASM flags
+# TODO: Add -s MAIN_MODULE=2 for dlopen() support.
+# The option disables code elimination, which increases code size of main
+# binary. All objects must be built with -fPIC.
case $ac_sys_system/$ac_sys_emscripten_target in #(
Emscripten/browser) :
- LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --preload-file \$(WASM_ASSETS_DIR)"
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1"
+ LINKFORSHARED="--preload-file \$(WASM_ASSETS_DIR)"
WASM_ASSETS_DIR=".\$(prefix)"
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
+ if test "$Py_DEBUG" = 'true'; then
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
+ LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
+ else
+ LINKFORSHARED="$LINKFORSHARED -O2 -g0"
+ fi
;; #(
Emscripten/node) :
- LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s EXIT_RUNTIME=1 -s USE_PTHREADS -s PROXY_TO_PTHREAD"
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s USE_PTHREADS=1"
+ LINKFORSHARED="-s PROXY_TO_PTHREAD=1 -s EXIT_RUNTIME=1"
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
+ if test "$Py_DEBUG" = 'true'; then
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
+ LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
+ else
+ LINKFORSHARED="$LINKFORSHARED -O2 -gseparate-dwarf"
+ fi
;; #(
WASI/*) :
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
+ Emscripten*)
+ LDSHARED='$(CC) -shared -s SIDE_MODULE=1'
+ LDCXXSHARED='$(CXX) -shared -s SIDE_MODULE=1'
+ ;;
FreeBSD*)
if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
then
fi
+if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
+ ZLIB_LIBS="-s USE_ZLIB=1"
+fi
+
if test "x$have_zlib" = xyes; then :
BINASCII_CFLAGS="-DUSE_ZLIB_CRC32 $ZLIB_CFLAGS"
have_bzip2=yes
fi
+if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
+ BZIP2_LIBS="-s USE_BZIP2=1"
+fi
+
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBLZMA" >&5
;;
esac
;;
+ *emcc*)
+ if test "$Py_LTO_POLICY" != "default"; then
+ AC_MSG_ERROR([emcc supports only default lto.])
+ fi
+ LTOFLAGS="-flto"
+ LTOCFLAGS="-flto"
+ ;;
*gcc*)
if test $Py_LTO_POLICY = thin
then
fi
# WASM flags
+# TODO: Add -s MAIN_MODULE=2 for dlopen() support.
+# The option disables code elimination, which increases code size of main
+# binary. All objects must be built with -fPIC.
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[Emscripten/browser], [
- LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --preload-file \$(WASM_ASSETS_DIR)"
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1"
+ LINKFORSHARED="--preload-file \$(WASM_ASSETS_DIR)"
WASM_ASSETS_DIR=".\$(prefix)"
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
+ dnl separate-dwarf does not seem to work in Chrome DevTools Support.
+ if test "$Py_DEBUG" = 'true'; then
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
+ LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
+ else
+ LINKFORSHARED="$LINKFORSHARED -O2 -g0"
+ fi
],
[Emscripten/node], [
- LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s EXIT_RUNTIME=1 -s USE_PTHREADS -s PROXY_TO_PTHREAD"
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s USE_PTHREADS=1"
+ LINKFORSHARED="-s PROXY_TO_PTHREAD=1 -s EXIT_RUNTIME=1"
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
+ if test "$Py_DEBUG" = 'true'; then
+ LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
+ LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
+ else
+ LINKFORSHARED="$LINKFORSHARED -O2 -gseparate-dwarf"
+ fi
],
[WASI/*], [
AC_DEFINE([_WASI_EMULATED_SIGNAL], [1], [Define to 1 if you want to emulate signals on WASI])
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
+ Emscripten*)
+ LDSHARED='$(CC) -shared -s SIDE_MODULE=1'
+ LDCXXSHARED='$(CXX) -shared -s SIDE_MODULE=1'
+ ;;
FreeBSD*)
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
then
], [have_zlib=no])
])
+if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
+ ZLIB_LIBS="-s USE_ZLIB=1"
+fi
+
dnl binascii can use zlib for optimized crc32.
AS_VAR_IF([have_zlib], [yes], [
BINASCII_CFLAGS="-DUSE_ZLIB_CRC32 $ZLIB_CFLAGS"
], [have_bzip2=no])
])
+if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
+ BZIP2_LIBS="-s USE_BZIP2=1"
+fi
+
+
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
AC_CHECK_HEADERS([lzma.h], [
WITH_SAVE_ENV([
MACOS = (HOST_PLATFORM == 'darwin')
AIX = (HOST_PLATFORM.startswith('aix'))
VXWORKS = ('vxworks' in HOST_PLATFORM)
+EMSCRIPTEN = HOST_PLATFORM == 'emscripten-wasm32'
CC = os.environ.get("CC")
if not CC:
CC = sysconfig.get_config_var("CC")
+if EMSCRIPTEN:
+ # emcc is a Python script from a different Python interpreter.
+ os.environ.pop("PYTHONPATH", None)
+
SUMMARY = """
Python is an interpreted, interactive, object-oriented programming