Skip to content

Commit f8b30fd

Browse files
authored
Bump pip dev dependency: coverage, ruff and mypy. NFC (emscripten-core#27350)
1 parent e44858e commit f8b30fd

12 files changed

Lines changed: 28 additions & 27 deletions

embuilder.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ def get_port_variant(name):
166166
else:
167167
old_settings = None
168168

169-
yield name
170-
171-
if old_settings:
172-
settings.dict().update(old_settings)
169+
try:
170+
yield name
171+
finally:
172+
if old_settings:
173+
settings.dict().update(old_settings)
173174

174175

175176
def clear_port(port_name):

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ lint.ignore = [
7676
"PLR6301",
7777
"PLW0602",
7878
"PLW0603",
79+
"PLW0717", # https://docs.astral.sh/ruff/rules/too-many-statements-in-try-clause
7980
"PLW1510",
8081
"PLW2901",
8182
"RUF012", # https://docs.astral.sh/ruff/rules/mutable-class-default/

requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
# the codebase and generate docs using Sphinx, not for users of emscripten.
55
# Install with `pip3 install -r requirements-dev.txt`
66

7-
coverage[toml]==6.5
8-
mypy==1.14
7+
coverage[toml]==7.15.0
8+
mypy==2.3.0
99
psutil==7.0.0
10-
ruff==0.15.7
10+
ruff==0.15.21
1111
types-requests==2.32.0.20241016
1212
unittest-xml-reporting==3.2.0
1313
deadcode==2.3.1

site/source/get_api_items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# if you change here, change everywhere.
2323
api_item_filename = 'api_items.py'
2424

25-
api_reference_items = {}
25+
api_reference_items: dict[str, str] = {}
2626

2727

2828
def parseFiles():

test/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,8 +1433,7 @@ def ccshared(src, linkto=None):
14331433
cfunc_ptr();
14341434
return 0;
14351435
}
1436-
''' % locals(),
1437-
'a: loaded\na: b (prev: (null))\na: c (prev: b)\n', cflags=extra_args)
1436+
''', 'a: loaded\na: b (prev: (null))\na: c (prev: b)\n', cflags=extra_args)
14381437

14391438
def do_run(self, src, *args, force_c=False, **kwargs):
14401439
if 'no_build' in kwargs:

test/jsrun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from tools import utils
1616

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

2020

test/parallel_testsuite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
EMTEST_VISUALIZE = os.getenv('EMTEST_VISUALIZE')
2323
NUM_CORES = None
24-
seen_class = set()
24+
seen_class: set[str] = set()
2525
torn_down = False
2626

2727

test/test_benchmark.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ def __init__(self, name):
313313
super().__init__(name, engine=None)
314314

315315
# we will not actually run the benchmarks
316-
run = None
316+
def run(self, args):
317+
assert False
317318

318319

319320
CHEERP_BIN = '/opt/cheerp/bin/'

tools/feature_matrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class Feature(IntEnum):
4444
GROWABLE_ARRAYBUFFERS = auto()
4545

4646

47-
disable_override_features = set()
48-
enable_override_features = set()
47+
disable_override_features: set[Feature] = set()
48+
enable_override_features: set[Feature] = set()
4949

5050
min_browser_versions = {
5151
# https://caniuse.com/wasm-nontrapping-fptoint

tools/file_packager.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@
9191
# chrome limit is 2MB under 2Gi
9292
PRELOAD_DATA_FILE_LIMIT = int(os.environ.get('EM_FILE_PACKAGER_MAX_CHUNK_SIZE_MB', '2046')) * 1024 * 1024
9393

94-
excluded_patterns: list[str] = []
95-
new_data_files = []
96-
walked = []
97-
9894

9995
class Options:
10096
def __init__(self):
@@ -133,6 +129,9 @@ class DataFile:
133129

134130

135131
options = Options()
132+
excluded_patterns: list[str] = []
133+
new_data_files: list[DataFile] = []
134+
walked: list[str] = []
136135

137136

138137
def err(*args):
@@ -323,13 +322,13 @@ def generate_object_file(data_files):
323322
# The `.dc.a` directive gives us a pointer (address) sized entry.
324323
# See https://sourceware.org/binutils/docs/as/Dc.html
325324
out.write(dedent(f'''\
326-
.p2align %s
325+
.p2align {align}
327326
.dc.a {f.c_symbol_name}_name
328-
.p2align %s
327+
.p2align {align}
329328
.int32 {os.path.getsize(f.srcpath)}
330-
.p2align %s
329+
.p2align {align}
331330
.dc.a {f.c_symbol_name}
332-
''' % (align, align, align)))
331+
'''))
333332

334333
ptr_size = 4
335334
elem_size = (2 * ptr_size) + 4

0 commit comments

Comments
 (0)