[+] update cli

This commit is contained in:
Siarhei Siniak 2025-02-18 18:29:48 +03:00
parent 01aab0517a
commit 905241a068
4 changed files with 61 additions and 16 deletions

@ -1 +1 @@
Subproject commit e27d400c07ddbe66e1ef73da1a5754c28cfec157 Subproject commit 352e3f68754ab93eb8449ee0751b40991f5a6b73

@ -141,7 +141,10 @@ class CLI(abc.ABC):
if not d.args is None: if not d.args is None:
cmd.extend(d.args) cmd.extend(d.args)
subprocess.check_call(cmd) subprocess.check_call(
cmd,
cwd=d.source_path,
)
else: else:
raise NotImplementedError raise NotImplementedError
@ -196,6 +199,7 @@ class CLI(abc.ABC):
force: Optional[bool] = None, force: Optional[bool] = None,
env: Optional[dict[str, str]] = None, env: Optional[dict[str, str]] = None,
mypy: bool = False, mypy: bool = False,
tests: bool = False,
) -> None: ) -> None:
project = self.projects[project_name] project = self.projects[project_name]
@ -212,6 +216,11 @@ class CLI(abc.ABC):
# assert argv is None or len(argv) == 0 # assert argv is None or len(argv) == 0
if not project.meson_path is None: if not project.meson_path is None:
if tests:
self.meson_test(
project_name=project_name,
)
self.meson_install( self.meson_install(
project_name=project_name, project_name=project_name,
force=force, force=force,
@ -257,6 +266,16 @@ class CLI(abc.ABC):
env=dict(list(os.environ.items())) | env, env=dict(list(os.environ.items())) | env,
) )
if tests:
subprocess.check_call(
[
'ninja',
'-C',
str(project.build_dir / 'pyproject'),
'test',
]
)
def meson_install( def meson_install(
self, self,
project_name: str, project_name: str,
@ -316,6 +335,25 @@ class CLI(abc.ABC):
*argv, *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( def meson_compile(
self, self,
project_name: str, project_name: str,
@ -377,4 +415,4 @@ class CLI(abc.ABC):
logger.info(dict(cmd=cmd)) logger.info(dict(cmd=cmd))
subprocess.check_call(cmd) subprocess.check_call(cmd)

@ -115,8 +115,21 @@ def env_bootstrap(
bootstrap_settings: BootstrapSettings, bootstrap_settings: BootstrapSettings,
pyproject: PyProject, pyproject: PyProject,
) -> None: ) -> 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([ subprocess.check_call([
'uv', 'venv', '--seed', '--offline', 'uv', 'venv',
*pip_find_links_args,
# '--seed',
'--offline',
str(bootstrap_settings.env_path) str(bootstrap_settings.env_path)
]) ])
@ -124,16 +137,18 @@ def env_bootstrap(
'uv', 'uv',
'pip', 'pip',
'install', 'install',
*pip_find_links_args,
'-p', '-p',
bootstrap_settings.python_path, bootstrap_settings.python_path,
'--offline', '--offline',
'uv', 'uv', 'pip',
]) ])
subprocess.check_call([ subprocess.check_call([
bootstrap_settings.python_path, bootstrap_settings.python_path,
'-m', '-m',
'uv', 'pip', 'install', 'uv', 'pip', 'install',
*pip_find_links_args,
'--offline', '--offline',
'build', 'setuptools', 'meson-python', 'pybind11', 'build', 'setuptools', 'meson-python', 'pybind11',
]) ])
@ -153,11 +168,6 @@ def env_bootstrap(
# *early_wheels, # *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: if pyproject.early_features:
early_dependencies = sum([ early_dependencies = sum([
pyproject.dependencies[o] pyproject.dependencies[o]
@ -173,10 +183,7 @@ def env_bootstrap(
bootstrap_settings.python_path, bootstrap_settings.python_path,
'-m', '-m',
'uv', 'pip', 'install', 'uv', 'pip', 'install',
*sum([ *pip_find_links_args,
['-f', str(o),]
for o in pip_find_links
], []),
# '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'), # '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'),
'--offline', '--offline',
*early_dependencies, *early_dependencies,
@ -238,4 +245,4 @@ def run(
) )
if __name__ == '__main__': if __name__ == '__main__':
run() run()

@ -1,6 +1,6 @@
[project] [project]
name = 'online.fxreader.pr34' name = 'online.fxreader.pr34'
version = '0.1.4.9' version = '0.1.4.12'
dependencies = [ dependencies = [
#"-r requirements.txt", #"-r requirements.txt",