From 778770b4d96fe58361a782b892a35cdf09082962 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 07:06:15 -0800 Subject: [PATCH 1/7] embuilder supports external ports --- embuilder.py | 14 ++++++++++++++ test/other/ports/external.py | 7 +++++-- test/test_other.py | 25 +++++++++++++++++++++++++ tools/ports/__init__.py | 23 +++++++++++------------ tools/ports/contrib/README.md | 4 ++-- tools/ports/contrib/glfw3.py | 4 ++-- tools/ports/sdl2_image.py | 2 +- 7 files changed, 60 insertions(+), 19 deletions(-) diff --git a/embuilder.py b/embuilder.py index 917a0361c123d..ecced2a0ea22e 100755 --- a/embuilder.py +++ b/embuilder.py @@ -169,6 +169,10 @@ def get_all_tasks(): return get_system_tasks()[1] + PORTS +def handle_port_error(arg, message): + raise Exception(f'Build target invalid `{arg}` | {message}') + + def main(): all_build_start_time = time.time() @@ -289,6 +293,16 @@ def main(): clear_port(what) if do_build: build_port(what) + elif ':' in what or what.endswith('.py'): + try: + name = ports.handle_use_port_arg(settings, what, lambda message: handle_port_error(what, message)) + except Exception as e: + logger.error(str(e)) + return 1 + if do_clear: + clear_port(name) + if do_build: + build_port(name) else: logger.error('unfamiliar build target: ' + what) return 1 diff --git a/test/other/ports/external.py b/test/other/ports/external.py index 0ca8eabc8b0f6..3df5adb6c190d 100644 --- a/test/other/ports/external.py +++ b/test/other/ports/external.py @@ -23,7 +23,10 @@ def get_lib_name(settings): - return 'lib_external.a' + if opts['dependency']: + return f'lib_external-{opts["dependency"]}.a' + else: + return 'lib_external.a' def get(ports, settings, shared): @@ -58,5 +61,5 @@ def process_dependencies(settings): deps.append(opts['dependency']) -def handle_options(options): +def handle_options(options, error_handler): opts.update(options) diff --git a/test/test_other.py b/test/test_other.py index 77fce4d6e3795..e5762c2f09b2b 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2418,6 +2418,31 @@ def test_external_ports(self): self.assertFalse(os.path.exists('a4.out.js')) self.assertContained('Unknown dependency `invalid` for port `external`', stderr) + @crossplatform + def test_embuilder_with_use_port_syntax(self): + if config.FROZEN_CACHE: + self.skipTest("test doesn't work with frozen cache") + self.run_process([EMBUILDER, 'build', 'sdl2_image:formats=png,jpg', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libSDL2_image_jpg-png.a')) + + @crossplatform + def test_embuilder_external_ports(self): + if config.FROZEN_CACHE: + self.skipTest("test doesn't work with frozen cache") + simple_port_path = test_file("other/ports/simple.py") + # embuilder handles external port target that ends with .py + self.run_process([EMBUILDER, 'build', f'{simple_port_path}', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_simple.a')) + # embuilder handles external port target that contains port options + external_port_path = test_file("other/ports/external.py") + self.run_process([EMBUILDER, 'build', f'{external_port_path}:value1=12:value2=36', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_external.a')) + # embuilder handles external port target that contains port options (influences library name, + # like sdl2_image:formats=png) + external_port_path = test_file("other/ports/external.py") + self.run_process([EMBUILDER, 'build', f'{external_port_path}:dependency=sdl2', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_external-sdl2.a')) + def test_link_memcpy(self): # memcpy can show up *after* optimizations, so after our opportunity to link in libc, so it must be special-cased create_file('main.c', r''' diff --git a/tools/ports/__init__.py b/tools/ports/__init__.py index 18ce4dd995f29..9be51f139b5f4 100644 --- a/tools/ports/__init__.py +++ b/tools/ports/__init__.py @@ -408,11 +408,9 @@ def add_deps(node): add_deps(port) -def handle_use_port_error(arg, message): - utils.exit_with_error(f'Error with `--use-port={arg}` | {message}') - - -def handle_use_port_arg(settings, arg): +def handle_use_port_arg(settings, arg, error_handler = None): + if not error_handler: + error_handler = lambda message: utils.exit_with_error(f'Error with `--use-port={arg}` | {message}') # Ignore ':' in first or second char of string since we could be dealing with a windows drive separator pos = arg.find(':', 2) if pos != -1: @@ -422,27 +420,28 @@ def handle_use_port_arg(settings, arg): if name.endswith('.py'): port_file_path = name if not os.path.isfile(port_file_path): - handle_use_port_error(arg, f'not a valid port path: {port_file_path}') + error_handler(f'not a valid port path: {port_file_path}') name = load_port_by_path(port_file_path) elif name not in ports_by_name: - handle_use_port_error(arg, f'invalid port name: `{name}`') + error_handler(f'invalid port name: `{name}`') ports_needed.add(name) if options: port = ports_by_name[name] if not hasattr(port, 'handle_options'): - handle_use_port_error(arg, f'no options available for port `{name}`') + error_handler(f'no options available for port `{name}`') else: options_dict = {} for name_value in options.split(':'): nv = name_value.split('=', 1) if len(nv) != 2: - handle_use_port_error(arg, f'`{name_value}` is missing a value') + error_handler(f'`{name_value}` is missing a value') if nv[0] not in port.OPTIONS: - handle_use_port_error(arg, f'`{nv[0]}` is not supported; available options are {port.OPTIONS}') + error_handler(f'`{nv[0]}` is not supported; available options are {port.OPTIONS}') if nv[0] in options_dict: - handle_use_port_error(arg, f'duplicate option `{nv[0]}`') + error_handler(f'duplicate option `{nv[0]}`') options_dict[nv[0]] = nv[1] - port.handle_options(options_dict) + port.handle_options(options_dict, error_handler) + return name def get_needed_ports(settings): diff --git a/tools/ports/contrib/README.md b/tools/ports/contrib/README.md index 670b53cbd90ab..e8637123a8df0 100644 --- a/tools/ports/contrib/README.md +++ b/tools/ports/contrib/README.md @@ -23,9 +23,9 @@ additional components: 1. A handler function defined this way: ```python -def handle_options(options): +def handle_options(options, error_handler): # options is of type Dict[str, str] - # in case of error, use utils.exit_with_error('error message') + # in case of error, use error_handler('error message') ``` 2. A dictionary called `OPTIONS` (type `Dict[str, str]`) where each key is the name of the option and the value is a short description of what it does diff --git a/tools/ports/contrib/glfw3.py b/tools/ports/contrib/glfw3.py index 7e83fdd301280..e13682e5135b6 100644 --- a/tools/ports/contrib/glfw3.py +++ b/tools/ports/contrib/glfw3.py @@ -83,9 +83,9 @@ def process_args(ports): return ['-isystem', ports.get_include_dir('contrib.glfw3')] -def handle_options(options): +def handle_options(options, error_handler): for option, value in options.items(): if value.lower() in {'true', 'false'}: opts[option] = value.lower() == 'true' else: - utils.exit_with_error(f'{option} is expecting a boolean, got {value}') + error_handler(f'{option} is expecting a boolean, got {value}') diff --git a/tools/ports/sdl2_image.py b/tools/ports/sdl2_image.py index 0adf74a0e5660..aef973eba3471 100644 --- a/tools/ports/sdl2_image.py +++ b/tools/ports/sdl2_image.py @@ -88,7 +88,7 @@ def process_dependencies(settings): settings.USE_LIBJPEG = 1 -def handle_options(options): +def handle_options(options, error_handler): opts['formats'].update({format.lower().strip() for format in options['formats'].split(',')}) From 2b382ed09e2f06385626de04a47dd08014b068b1 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 07:14:31 -0800 Subject: [PATCH 2/7] removed unnecessary import --- tools/ports/contrib/glfw3.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/ports/contrib/glfw3.py b/tools/ports/contrib/glfw3.py index e13682e5135b6..fe46d695e75e6 100644 --- a/tools/ports/contrib/glfw3.py +++ b/tools/ports/contrib/glfw3.py @@ -4,7 +4,6 @@ # found in the LICENSE file. import os -from tools import utils from typing import Dict TAG = '1.0.4' From 6a97d807ffe5ea8421114159efc3e15db213fe30 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 07:22:50 -0800 Subject: [PATCH 3/7] flake8 issues --- tools/ports/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/ports/__init__.py b/tools/ports/__init__.py index 9be51f139b5f4..c93e756ecb797 100644 --- a/tools/ports/__init__.py +++ b/tools/ports/__init__.py @@ -408,9 +408,14 @@ def add_deps(node): add_deps(port) -def handle_use_port_arg(settings, arg, error_handler = None): +def handle_use_port_error(arg, message): + utils.exit_with_error(f'Error with `--use-port={arg}` | {message}') + + +def handle_use_port_arg(settings, arg, error_handler=None): if not error_handler: - error_handler = lambda message: utils.exit_with_error(f'Error with `--use-port={arg}` | {message}') + def error_handler(message): + handle_use_port_error(arg, message) # Ignore ':' in first or second char of string since we could be dealing with a windows drive separator pos = arg.find(':', 2) if pos != -1: From 45d2fda62e1f88d7c5b7459ed5e0522b76866510 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 08:20:23 -0800 Subject: [PATCH 4/7] simplified code --- embuilder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/embuilder.py b/embuilder.py index ecced2a0ea22e..3f22705454ffd 100755 --- a/embuilder.py +++ b/embuilder.py @@ -169,8 +169,8 @@ def get_all_tasks(): return get_system_tasks()[1] + PORTS -def handle_port_error(arg, message): - raise Exception(f'Build target invalid `{arg}` | {message}') +def handle_port_error(message): + raise Exception(message) def main(): @@ -295,9 +295,9 @@ def main(): build_port(what) elif ':' in what or what.endswith('.py'): try: - name = ports.handle_use_port_arg(settings, what, lambda message: handle_port_error(what, message)) + name = ports.handle_use_port_arg(settings, what, lambda message: handle_port_error(message)) except Exception as e: - logger.error(str(e)) + logger.error(f'Build target invalid `{what}` | {e}') return 1 if do_clear: clear_port(name) From 4be9926d050321418f5d40e921f56ab5e0280e63 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 12:27:29 -0800 Subject: [PATCH 5/7] code review --- embuilder.py | 11 ++++------- test/test_other.py | 25 ------------------------- test/test_sanity.py | 22 ++++++++++++++++++++++ tools/ports/contrib/README.md | 3 ++- tools/ports/sdl2_image.py | 11 ++++++++++- 5 files changed, 38 insertions(+), 34 deletions(-) diff --git a/embuilder.py b/embuilder.py index 3f22705454ffd..d2cbf8689f157 100755 --- a/embuilder.py +++ b/embuilder.py @@ -23,6 +23,7 @@ from tools import shared from tools import system_libs from tools import ports +from tools import utils from tools.settings import settings from tools.system_libs import USE_NINJA @@ -169,8 +170,8 @@ def get_all_tasks(): return get_system_tasks()[1] + PORTS -def handle_port_error(message): - raise Exception(message) +def handle_port_error(target, message): + utils.exit_with_error(f'Build target invalid `{target}` | {message}') def main(): @@ -294,11 +295,7 @@ def main(): if do_build: build_port(what) elif ':' in what or what.endswith('.py'): - try: - name = ports.handle_use_port_arg(settings, what, lambda message: handle_port_error(message)) - except Exception as e: - logger.error(f'Build target invalid `{what}` | {e}') - return 1 + name = ports.handle_use_port_arg(settings, what, lambda message: handle_port_error(what, message)) if do_clear: clear_port(name) if do_build: diff --git a/test/test_other.py b/test/test_other.py index e5762c2f09b2b..77fce4d6e3795 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2418,31 +2418,6 @@ def test_external_ports(self): self.assertFalse(os.path.exists('a4.out.js')) self.assertContained('Unknown dependency `invalid` for port `external`', stderr) - @crossplatform - def test_embuilder_with_use_port_syntax(self): - if config.FROZEN_CACHE: - self.skipTest("test doesn't work with frozen cache") - self.run_process([EMBUILDER, 'build', 'sdl2_image:formats=png,jpg', '--force']) - self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libSDL2_image_jpg-png.a')) - - @crossplatform - def test_embuilder_external_ports(self): - if config.FROZEN_CACHE: - self.skipTest("test doesn't work with frozen cache") - simple_port_path = test_file("other/ports/simple.py") - # embuilder handles external port target that ends with .py - self.run_process([EMBUILDER, 'build', f'{simple_port_path}', '--force']) - self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_simple.a')) - # embuilder handles external port target that contains port options - external_port_path = test_file("other/ports/external.py") - self.run_process([EMBUILDER, 'build', f'{external_port_path}:value1=12:value2=36', '--force']) - self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_external.a')) - # embuilder handles external port target that contains port options (influences library name, - # like sdl2_image:formats=png) - external_port_path = test_file("other/ports/external.py") - self.run_process([EMBUILDER, 'build', f'{external_port_path}:dependency=sdl2', '--force']) - self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_external-sdl2.a')) - def test_link_memcpy(self): # memcpy can show up *after* optimizations, so after our opportunity to link in libc, so it must be special-cased create_file('main.c', r''' diff --git a/test/test_sanity.py b/test/test_sanity.py index 0375e28237a9d..95aab038bdf43 100644 --- a/test/test_sanity.py +++ b/test/test_sanity.py @@ -748,6 +748,28 @@ def test_embuilder_wildcards(self): self.run_process([EMBUILDER, 'build', 'libwebgpu*']) self.assertGreater(len(glob.glob(glob_match)), 3) + def test_embuilder_with_use_port_syntax(self): + restore_and_set_up() + self.run_process([EMBUILDER, 'build', 'sdl2_image:formats=png,jpg', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libSDL2_image_jpg-png.a')) + self.assertContained('Build target invalid `sdl2_image:formats=invalid` | invalid is not a supported format', self.do([EMBUILDER, 'build', 'sdl2_image:formats=invalid', '--force'])) + + def test_embuilder_external_ports(self): + restore_and_set_up() + simple_port_path = test_file("other/ports/simple.py") + # embuilder handles external port target that ends with .py + self.run_process([EMBUILDER, 'build', f'{simple_port_path}', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_simple.a')) + # embuilder handles external port target that contains port options + external_port_path = test_file("other/ports/external.py") + self.run_process([EMBUILDER, 'build', f'{external_port_path}:value1=12:value2=36', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_external.a')) + # embuilder handles external port target that contains port options (influences library name, + # like sdl2_image:formats=png) + external_port_path = test_file("other/ports/external.py") + self.run_process([EMBUILDER, 'build', f'{external_port_path}:dependency=sdl2', '--force']) + self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lib_external-sdl2.a')) + def test_binaryen_version(self): restore_and_set_up() with open(EM_CONFIG, 'a') as f: diff --git a/tools/ports/contrib/README.md b/tools/ports/contrib/README.md index e8637123a8df0..42fa65edc10da 100644 --- a/tools/ports/contrib/README.md +++ b/tools/ports/contrib/README.md @@ -26,6 +26,7 @@ additional components: def handle_options(options, error_handler): # options is of type Dict[str, str] # in case of error, use error_handler('error message') + # note that error_handler is guaranteed to never return ``` 2. A dictionary called `OPTIONS` (type `Dict[str, str]`) where each key is the name of the option and the value is a short description of what it does @@ -33,7 +34,7 @@ def handle_options(options, error_handler): When emscripten detects that options have been provided, it parses them and check that they are valid option names for this port (using `OPTIONS`). It then calls the handler function with these (valid) options. If you detect an error -with a value, you should use `tools.utils.exit_with_error` to report the +with a value, you should use the error handler provided to report the failure. > ### Note diff --git a/tools/ports/sdl2_image.py b/tools/ports/sdl2_image.py index aef973eba3471..2addb21b4d02f 100644 --- a/tools/ports/sdl2_image.py +++ b/tools/ports/sdl2_image.py @@ -19,6 +19,9 @@ 'formats': 'A comma separated list of formats (ex: --use-port=sdl2_image:formats=png,jpg)' } +SUPPORTED_FORMATS = {'avif', 'bmp', 'gif', 'jpg', 'jxl', 'lbm', 'pcx', 'png', + 'pnm', 'qoi', 'svg', 'tga', 'tif', 'webp', 'xcf', 'xpm', 'xv'} + # user options (from --use-port) opts: Dict[str, Set] = { 'formats': set() @@ -89,7 +92,13 @@ def process_dependencies(settings): def handle_options(options, error_handler): - opts['formats'].update({format.lower().strip() for format in options['formats'].split(',')}) + formats = options['formats'].split(',') + for format in formats: + format = format.lower().strip() + if format not in SUPPORTED_FORMATS: + error_handler(f'{format} is not a supported format') + else: + opts['formats'].add(format) def show(): From a277612523adff25ce7e4959841b246ba806453a Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 12:46:24 -0800 Subject: [PATCH 6/7] fixed error message per review --- embuilder.py | 2 +- test/test_sanity.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/embuilder.py b/embuilder.py index d2cbf8689f157..c4a77cbe1b644 100755 --- a/embuilder.py +++ b/embuilder.py @@ -171,7 +171,7 @@ def get_all_tasks(): def handle_port_error(target, message): - utils.exit_with_error(f'Build target invalid `{target}` | {message}') + utils.exit_with_error(f'Error building port `{target}` | {message}') def main(): diff --git a/test/test_sanity.py b/test/test_sanity.py index 95aab038bdf43..f037b9c390610 100644 --- a/test/test_sanity.py +++ b/test/test_sanity.py @@ -752,7 +752,7 @@ def test_embuilder_with_use_port_syntax(self): restore_and_set_up() self.run_process([EMBUILDER, 'build', 'sdl2_image:formats=png,jpg', '--force']) self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libSDL2_image_jpg-png.a')) - self.assertContained('Build target invalid `sdl2_image:formats=invalid` | invalid is not a supported format', self.do([EMBUILDER, 'build', 'sdl2_image:formats=invalid', '--force'])) + self.assertContained('Error building port `sdl2_image:formats=invalid` | invalid is not a supported format', self.do([EMBUILDER, 'build', 'sdl2_image:formats=invalid', '--force'])) def test_embuilder_external_ports(self): restore_and_set_up() From f8b1879f93cc8ee47724a471c44d6e1f6e30deb6 Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Wed, 14 Feb 2024 12:59:06 -0800 Subject: [PATCH 7/7] fixed error message capital --- embuilder.py | 2 +- test/test_other.py | 12 ++++++------ test/test_sanity.py | 2 +- tools/ports/__init__.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/embuilder.py b/embuilder.py index c4a77cbe1b644..3c770a7d05e96 100755 --- a/embuilder.py +++ b/embuilder.py @@ -171,7 +171,7 @@ def get_all_tasks(): def handle_port_error(target, message): - utils.exit_with_error(f'Error building port `{target}` | {message}') + utils.exit_with_error(f'error building port `{target}` | {message}') def main(): diff --git a/test/test_other.py b/test/test_other.py index 7a8f24abecab4..7c0759dc7c9e6 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2416,7 +2416,7 @@ def test_external_ports(self): # testing invalid dependency stderr = self.expect_fail([EMCC, test_file('other/test_external_ports.c'), f'--use-port={external_port_path}:dependency=invalid', '-o', 'a4.out.js']) self.assertFalse(os.path.exists('a4.out.js')) - self.assertContained('Unknown dependency `invalid` for port `external`', stderr) + self.assertContained('unknown dependency `invalid` for port `external`', stderr) def test_link_memcpy(self): # memcpy can show up *after* optimizations, so after our opportunity to link in libc, so it must be special-cased @@ -14557,16 +14557,16 @@ def test_js_preprocess_pre_post(self): def test_use_port_errors(self, compiler): stderr = self.expect_fail([compiler, test_file('hello_world.c'), '--use-port=invalid', '-o', 'out.js']) self.assertFalse(os.path.exists('out.js')) - self.assertContained('Error with `--use-port=invalid` | invalid port name: `invalid`', stderr) + self.assertContained('error with `--use-port=invalid` | invalid port name: `invalid`', stderr) stderr = self.expect_fail([compiler, test_file('hello_world.c'), '--use-port=sdl2:opt1=v1', '-o', 'out.js']) self.assertFalse(os.path.exists('out.js')) - self.assertContained('Error with `--use-port=sdl2:opt1=v1` | no options available for port `sdl2`', stderr) + self.assertContained('error with `--use-port=sdl2:opt1=v1` | no options available for port `sdl2`', stderr) stderr = self.expect_fail([compiler, test_file('hello_world.c'), '--use-port=sdl2_image:format=jpg', '-o', 'out.js']) self.assertFalse(os.path.exists('out.js')) - self.assertContained('Error with `--use-port=sdl2_image:format=jpg` | `format` is not supported', stderr) + self.assertContained('error with `--use-port=sdl2_image:format=jpg` | `format` is not supported', stderr) stderr = self.expect_fail([compiler, test_file('hello_world.c'), '--use-port=sdl2_image:formats', '-o', 'out.js']) self.assertFalse(os.path.exists('out.js')) - self.assertContained('Error with `--use-port=sdl2_image:formats` | `formats` is missing a value', stderr) + self.assertContained('error with `--use-port=sdl2_image:formats` | `formats` is missing a value', stderr) stderr = self.expect_fail([compiler, test_file('hello_world.c'), '--use-port=sdl2_image:formats=jpg:formats=png', '-o', 'out.js']) self.assertFalse(os.path.exists('out.js')) - self.assertContained('Error with `--use-port=sdl2_image:formats=jpg:formats=png` | duplicate option `formats`', stderr) + self.assertContained('error with `--use-port=sdl2_image:formats=jpg:formats=png` | duplicate option `formats`', stderr) diff --git a/test/test_sanity.py b/test/test_sanity.py index f037b9c390610..e1de89dd12711 100644 --- a/test/test_sanity.py +++ b/test/test_sanity.py @@ -752,7 +752,7 @@ def test_embuilder_with_use_port_syntax(self): restore_and_set_up() self.run_process([EMBUILDER, 'build', 'sdl2_image:formats=png,jpg', '--force']) self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libSDL2_image_jpg-png.a')) - self.assertContained('Error building port `sdl2_image:formats=invalid` | invalid is not a supported format', self.do([EMBUILDER, 'build', 'sdl2_image:formats=invalid', '--force'])) + self.assertContained('error building port `sdl2_image:formats=invalid` | invalid is not a supported format', self.do([EMBUILDER, 'build', 'sdl2_image:formats=invalid', '--force'])) def test_embuilder_external_ports(self): restore_and_set_up() diff --git a/tools/ports/__init__.py b/tools/ports/__init__.py index c93e756ecb797..2241991ece9f6 100644 --- a/tools/ports/__init__.py +++ b/tools/ports/__init__.py @@ -398,7 +398,7 @@ def add_deps(node): node.process_dependencies(settings) for d in node.deps: if d not in ports_by_name: - utils.exit_with_error(f'Unknown dependency `{d}` for port `{node.name}`') + utils.exit_with_error(f'unknown dependency `{d}` for port `{node.name}`') dep = ports_by_name[d] if dep not in port_set: port_set.add(dep) @@ -409,7 +409,7 @@ def add_deps(node): def handle_use_port_error(arg, message): - utils.exit_with_error(f'Error with `--use-port={arg}` | {message}') + utils.exit_with_error(f'error with `--use-port={arg}` | {message}') def handle_use_port_arg(settings, arg, error_handler=None):