[+] use meson from venv

1. fix typing for tomllib,
    since it is found in python <3.11
This commit is contained in:
Siarhei Siniak 2025-05-23 11:31:08 +03:00
parent b4199d3faa
commit 66e32b4fc9
4 changed files with 43 additions and 21 deletions

@ -5,7 +5,7 @@ project(
).stdout().strip('\n'), ).stdout().strip('\n'),
# 'online.fxreader.uv', # 'online.fxreader.uv',
# ['c', 'cpp'], # ['c', 'cpp'],
version: '0.1.5.17+27.2', version: '0.1.5.17+27.3',
# default_options: [ # default_options: [
# 'cpp_std=c++23', # 'cpp_std=c++23',
# # 'prefer_static=true', # # 'prefer_static=true',

@ -421,10 +421,13 @@ class CLI(abc.ABC):
argv = pyproject_tool.meson.args.install + argv argv = pyproject_tool.meson.args.install + argv
cmd = [ cmd = [
shutil_which( str(self.dist_settings.python_path),
'meson', '-m',
True, 'mesonbuild.mesonmain',
), # shutil_which(
# 'meson',
# True,
# ),
'install', 'install',
'-C', '-C',
str(project.build_dir / 'meson'), str(project.build_dir / 'meson'),
@ -496,10 +499,12 @@ class CLI(abc.ABC):
subprocess.check_call( subprocess.check_call(
[ [
shutil_which( str(self.dist_settings.python_path),
'meson', 'mesonbuild.mesonmain',
True, # shutil_which(
), # 'meson',
# True,
# ),
'test', 'test',
'-C', '-C',
project.build_dir / 'meson', project.build_dir / 'meson',
@ -519,10 +524,13 @@ class CLI(abc.ABC):
subprocess.check_call( subprocess.check_call(
[ [
shutil_which( str(self.dist_settings.python_path),
'meson', '-m',
True, 'mesonbuild.mesonmain',
), # shutil_which(
# 'meson',
# True,
# ),
'compile', 'compile',
'-C', '-C',
project.build_dir / 'meson', project.build_dir / 'meson',
@ -572,10 +580,13 @@ class CLI(abc.ABC):
extra_args = pyproject_tool.meson.args.setup + extra_args extra_args = pyproject_tool.meson.args.setup + extra_args
cmd = [ cmd = [
shutil_which( # shutil_which(
'meson', # 'meson',
True, # True,
), # ),
str(self.dist_settings.python_path),
'-m',
'mesonbuild.mesonmain',
'setup', 'setup',
str(project.source_dir), str(project.source_dir),
str(project.build_dir / 'meson'), str(project.build_dir / 'meson'),

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import glob import glob
import importlib
import json import json
import io import io
import tempfile import tempfile
@ -18,6 +19,7 @@ from typing import (
cast, cast,
Type, Type,
TypeVar, TypeVar,
Callable,
) )
from typing_extensions import ( from typing_extensions import (
Self, Self,
@ -30,17 +32,23 @@ logger = logging.getLogger(__name__)
def toml_load(f: BinaryIO) -> Any: def toml_load(f: BinaryIO) -> Any:
try: try:
import tomllib tomllib = importlib.import_module('tomllib')
return tomllib.load(f) return cast(
except: Callable[[Any], Any],
getattr(
tomllib,
'load',
),
)(f)
except ModuleNotFoundError:
pass pass
try: try:
import tomli import tomli
return tomli.load(f) return tomli.load(f)
except: except ModuleNotFoundError:
pass pass
raise NotImplementedError raise NotImplementedError

Binary file not shown.