Skip to content
Open
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
9 changes: 5 additions & 4 deletions embuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ def get_port_variant(name):
else:
old_settings = None

yield name

if old_settings:
settings.dict().update(old_settings)
try:
yield name
finally:
if old_settings:
settings.dict().update(old_settings)
Comment thread
sbc100 marked this conversation as resolved.


def clear_port(port_name):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ lint.ignore = [
"PLR6301",
"PLW0602",
"PLW0603",
"PLW0717", # https://docs.astral.sh/ruff/rules/too-many-statements-in-try-clause
"PLW1510",
"PLW2901",
"RUF012", # https://docs.astral.sh/ruff/rules/mutable-class-default/
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# the codebase and generate docs using Sphinx, not for users of emscripten.
# Install with `pip3 install -r requirements-dev.txt`

coverage[toml]==6.5
mypy==1.14
coverage[toml]==7.15.0
mypy==2.3.0
psutil==7.0.0
ruff==0.15.7
ruff==0.15.21
types-requests==2.32.0.20241016
unittest-xml-reporting==3.2.0
deadcode==2.3.1
Expand Down
2 changes: 1 addition & 1 deletion site/source/get_api_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# if you change here, change everywhere.
api_item_filename = 'api_items.py'

api_reference_items = {}
api_reference_items: dict[str, str] = {}


def parseFiles():
Expand Down
3 changes: 1 addition & 2 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1433,8 +1433,7 @@ def ccshared(src, linkto=None):
cfunc_ptr();
return 0;
}
''' % locals(),
'a: loaded\na: b (prev: (null))\na: c (prev: b)\n', cflags=extra_args)
''', 'a: loaded\na: b (prev: (null))\na: c (prev: b)\n', cflags=extra_args)

def do_run(self, src, *args, force_c=False, **kwargs):
if 'no_build' in kwargs:
Expand Down
2 changes: 1 addition & 1 deletion test/jsrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from tools import utils

WORKING_ENGINES = {} # Holds all configured engines and whether they work: maps path -> True/False
WORKING_ENGINES: dict[str, bool] = {} # Holds all configured engines and whether they work: maps path -> True/False
DEFAULT_TIMEOUT = int(os.environ.get('EMTEST_TIMEOUT', str(5 * 60)))


Expand Down
2 changes: 1 addition & 1 deletion test/parallel_testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

EMTEST_VISUALIZE = os.getenv('EMTEST_VISUALIZE')
NUM_CORES = None
seen_class = set()
seen_class: set[str] = set()
torn_down = False


Expand Down
3 changes: 2 additions & 1 deletion test/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ def __init__(self, name):
super().__init__(name, engine=None)

# we will not actually run the benchmarks
run = None
def run(self, args):
assert False


CHEERP_BIN = '/opt/cheerp/bin/'
Expand Down
4 changes: 2 additions & 2 deletions tools/feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class Feature(IntEnum):
GROWABLE_ARRAYBUFFERS = auto()


disable_override_features = set()
enable_override_features = set()
disable_override_features: set[Feature] = set()
enable_override_features: set[Feature] = set()

min_browser_versions = {
# https://caniuse.com/wasm-nontrapping-fptoint
Expand Down
15 changes: 7 additions & 8 deletions tools/file_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
# chrome limit is 2MB under 2Gi
PRELOAD_DATA_FILE_LIMIT = int(os.environ.get('EM_FILE_PACKAGER_MAX_CHUNK_SIZE_MB', '2046')) * 1024 * 1024

excluded_patterns: list[str] = []
new_data_files = []
walked = []


class Options:
def __init__(self):
Expand Down Expand Up @@ -133,6 +129,9 @@ class DataFile:


options = Options()
excluded_patterns: list[str] = []
new_data_files: list[DataFile] = []
walked: list[str] = []


def err(*args):
Expand Down Expand Up @@ -323,13 +322,13 @@ def generate_object_file(data_files):
# The `.dc.a` directive gives us a pointer (address) sized entry.
# See https://sourceware.org/binutils/docs/as/Dc.html
out.write(dedent(f'''\
.p2align %s
.p2align {align}
.dc.a {f.c_symbol_name}_name
.p2align %s
.p2align {align}
.int32 {os.path.getsize(f.srcpath)}
.p2align %s
.p2align {align}
.dc.a {f.c_symbol_name}
''' % (align, align, align)))
'''))

ptr_size = 4
elem_size = (2 * ptr_size) + 4
Expand Down
2 changes: 1 addition & 1 deletion tools/maint/rebaseline_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def run(cmd, **args):
return subprocess.check_output(cmd, text=True, cwd=root_dir, **args)


all_deltas = []
all_deltas: list[int] = []


def read_size_from_json(content):
Expand Down
6 changes: 3 additions & 3 deletions tools/ports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
from tools.settings import settings
from tools.toolchain_profiler import ToolchainProfiler

ports = []
ports: list[dict] = []

ports_by_name: dict[str, object] = {}

ports_needed = set()
ports_needed: set[str] = set()

# Variant builds that we want to support for certain ports
# {variant_name: (port_name, extra_settings)}
port_variants = {}
port_variants: dict[str, tuple] = {}

ports_dir = os.path.dirname(os.path.abspath(__file__))

Expand Down