From 905241a0688f1cd5a9a127450f32fa54b63a4260 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Tue, 18 Feb 2025 18:29:48 +0300 Subject: [PATCH] [+] update cli --- deps/com.github.aiortc.aiortc | 2 +- .../fxreader/pr34/commands_typed/cli.py | 42 ++++++++++++++++++- .../pr34/commands_typed/cli_bootstrap.py | 31 ++++++++------ python/pyproject.toml | 2 +- 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/deps/com.github.aiortc.aiortc b/deps/com.github.aiortc.aiortc index e27d400..352e3f6 160000 --- a/deps/com.github.aiortc.aiortc +++ b/deps/com.github.aiortc.aiortc @@ -1 +1 @@ -Subproject commit e27d400c07ddbe66e1ef73da1a5754c28cfec157 +Subproject commit 352e3f68754ab93eb8449ee0751b40991f5a6b73 diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index da932c1..872b28d 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -141,7 +141,10 @@ class CLI(abc.ABC): if not d.args is None: cmd.extend(d.args) - subprocess.check_call(cmd) + subprocess.check_call( + cmd, + cwd=d.source_path, + ) else: raise NotImplementedError @@ -196,6 +199,7 @@ class CLI(abc.ABC): force: Optional[bool] = None, env: Optional[dict[str, str]] = None, mypy: bool = False, + tests: bool = False, ) -> None: project = self.projects[project_name] @@ -212,6 +216,11 @@ class CLI(abc.ABC): # assert argv is None or len(argv) == 0 if not project.meson_path is None: + if tests: + self.meson_test( + project_name=project_name, + ) + self.meson_install( project_name=project_name, force=force, @@ -257,6 +266,16 @@ class CLI(abc.ABC): env=dict(list(os.environ.items())) | env, ) + if tests: + subprocess.check_call( + [ + 'ninja', + '-C', + str(project.build_dir / 'pyproject'), + 'test', + ] + ) + def meson_install( self, project_name: str, @@ -316,6 +335,25 @@ class CLI(abc.ABC): *argv, ]) + def meson_test( + self, + project_name: str, + argv: Optional[list[str]] = None, + ) -> None: + project = self.projects[project_name] + + if argv is None: + argv = [] + + subprocess.check_call([ + shutil_which('meson', True,), + 'test', + '-C', + project.build_dir / 'meson', + *argv, + ]) + + def meson_compile( self, project_name: str, @@ -377,4 +415,4 @@ class CLI(abc.ABC): logger.info(dict(cmd=cmd)) - subprocess.check_call(cmd) \ No newline at end of file + subprocess.check_call(cmd) diff --git a/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py b/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py index 51692c6..ab596c4 100644 --- a/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py +++ b/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py @@ -115,8 +115,21 @@ def env_bootstrap( bootstrap_settings: BootstrapSettings, pyproject: PyProject, ) -> None: + pip_find_links : list[pathlib.Path] = [] + + if not pyproject.pip_find_links is None: + pip_find_links.extend(pyproject.pip_find_links) + + pip_find_links_args = sum([ + ['-f', str(o),] + for o in pip_find_links + ], []) + subprocess.check_call([ - 'uv', 'venv', '--seed', '--offline', + 'uv', 'venv', + *pip_find_links_args, + # '--seed', + '--offline', str(bootstrap_settings.env_path) ]) @@ -124,16 +137,18 @@ def env_bootstrap( 'uv', 'pip', 'install', + *pip_find_links_args, '-p', bootstrap_settings.python_path, '--offline', - 'uv', + 'uv', 'pip', ]) subprocess.check_call([ bootstrap_settings.python_path, '-m', 'uv', 'pip', 'install', + *pip_find_links_args, '--offline', 'build', 'setuptools', 'meson-python', 'pybind11', ]) @@ -153,11 +168,6 @@ def env_bootstrap( # *early_wheels, # ]) - pip_find_links : list[pathlib.Path] = [] - - if not pyproject.pip_find_links is None: - pip_find_links.extend(pyproject.pip_find_links) - if pyproject.early_features: early_dependencies = sum([ pyproject.dependencies[o] @@ -173,10 +183,7 @@ def env_bootstrap( bootstrap_settings.python_path, '-m', 'uv', 'pip', 'install', - *sum([ - ['-f', str(o),] - for o in pip_find_links - ], []), + *pip_find_links_args, # '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'), '--offline', *early_dependencies, @@ -238,4 +245,4 @@ def run( ) if __name__ == '__main__': - run() \ No newline at end of file + run() diff --git a/python/pyproject.toml b/python/pyproject.toml index c8f6a34..45fcafc 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = 'online.fxreader.pr34' -version = '0.1.4.9' +version = '0.1.4.12' dependencies = [ #"-r requirements.txt",