Toshaan Bharvani
5 months ago
9 changed files with 629 additions and 0 deletions
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
From a51e8ddfdc246dd3a03edb18712136c38829799f Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 2 Nov 2022 10:06:40 +0100 |
||||
Subject: [PATCH 1/9] accept positional arguments for python.dependency |
||||
Content-Type: text/plain |
||||
|
||||
Partial revert of upstream commit 1f7ab2f0100. |
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
||||
--- |
||||
mesonbuild/modules/python.py | 6 +++++- |
||||
1 file changed, 5 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py |
||||
index 6728cd401..39967cbae 100644 |
||||
--- a/mesonbuild/modules/python.py |
||||
+++ b/mesonbuild/modules/python.py |
||||
@@ -576,8 +576,12 @@ class PythonInstallation(ExternalProgramHolder): |
||||
@disablerIfNotFound |
||||
@permittedKwargs(permitted_dependency_kwargs | {'embed'}) |
||||
@FeatureNewKwargs('python_installation.dependency', '0.53.0', ['embed']) |
||||
- @noPosargs |
||||
def dependency_method(self, args: T.List['TYPE_var'], kwargs: 'TYPE_kwargs') -> 'Dependency': |
||||
+ if args: |
||||
+ mlog.warning('python_installation.dependency() does not take any ' |
||||
+ 'positional arguments. It always returns a Python ' |
||||
+ 'dependency. This will become an error in the future.', |
||||
+ location=self.interpreter.current_node) |
||||
disabled, required, feature = extract_required_kwarg(kwargs, self.subproject) |
||||
if disabled: |
||||
mlog.log('Dependency', mlog.bold('python'), 'skipped: feature', mlog.bold(feature), 'disabled') |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,114 @@
@@ -0,0 +1,114 @@
|
||||
From cb683b38e0252d545650d55424ba4f7077c5b813 Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 2 Nov 2022 10:07:17 +0100 |
||||
Subject: [PATCH 2/9] Revert "decorators: Make unknown kwarg fatal" |
||||
Content-Type: text/plain |
||||
|
||||
This reverts commit 88a1bed81b7d9ad262d3b511eb20444c609db235. |
||||
--- |
||||
mesonbuild/interpreterbase/decorators.py | 16 ++++++++++------ |
||||
.../common/129 build by default/meson.build | 1 + |
||||
test cases/frameworks/7 gnome/gir/meson.build | 4 ++++ |
||||
test cases/unit/22 warning location/meson.build | 2 +- |
||||
unittests/allplatformstests.py | 6 +++--- |
||||
5 files changed, 19 insertions(+), 10 deletions(-) |
||||
|
||||
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py |
||||
index 5dd8b8982..41c959a63 100644 |
||||
--- a/mesonbuild/interpreterbase/decorators.py |
||||
+++ b/mesonbuild/interpreterbase/decorators.py |
||||
@@ -119,11 +119,11 @@ class permittedKwargs: |
||||
def __call__(self, f: TV_func) -> TV_func: |
||||
@wraps(f) |
||||
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any: |
||||
- kwargs = get_callee_args(wrapped_args)[2] |
||||
- unknowns = set(kwargs).difference(self.permitted) |
||||
- if unknowns: |
||||
- ustr = ', '.join([f'"{u}"' for u in sorted(unknowns)]) |
||||
- raise InvalidArguments(f'Got unknown keyword arguments {ustr}') |
||||
+ node, args, kwargs, _ = get_callee_args(wrapped_args) |
||||
+ for k in kwargs: |
||||
+ if k not in self.permitted: |
||||
+ mlog.warning(f'''Passed invalid keyword argument "{k}".''', location=node) |
||||
+ mlog.warning('This will become a hard error in the future.') |
||||
return f(*wrapped_args, **wrapped_kwargs) |
||||
return T.cast('TV_func', wrapped) |
||||
|
||||
@@ -532,8 +532,12 @@ def typed_kwargs(name: str, *types: KwargInfo) -> T.Callable[..., T.Any]: |
||||
all_names = {t.name for t in types} |
||||
unknowns = set(kwargs).difference(all_names) |
||||
if unknowns: |
||||
+ # Warn about unknown argumnts, delete them and continue. This |
||||
+ # keeps current behavior |
||||
ustr = ', '.join([f'"{u}"' for u in sorted(unknowns)]) |
||||
- raise InvalidArguments(f'{name} got unknown keyword arguments {ustr}') |
||||
+ mlog.warning(f'{name} got unknown keyword arguments {ustr}') |
||||
+ for u in unknowns: |
||||
+ del kwargs[u] |
||||
|
||||
for info in types: |
||||
types_tuple = info.types if isinstance(info.types, tuple) else (info.types,) |
||||
diff --git a/test cases/common/129 build by default/meson.build b/test cases/common/129 build by default/meson.build |
||||
index b797f76e9..b28b6347c 100644 |
||||
--- a/test cases/common/129 build by default/meson.build |
||||
+++ b/test cases/common/129 build by default/meson.build |
||||
@@ -9,6 +9,7 @@ executable('fooprog', 'foo.c', |
||||
|
||||
executable('barprog', 'foo.c', |
||||
build_by_default : false, |
||||
+ build_always : true, |
||||
) |
||||
|
||||
comp = files('mygen.py') |
||||
diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build |
||||
index fbff2060e..64c49f729 100644 |
||||
--- a/test cases/frameworks/7 gnome/gir/meson.build |
||||
+++ b/test cases/frameworks/7 gnome/gir/meson.build |
||||
@@ -46,6 +46,10 @@ gnome.generate_gir( |
||||
dependencies : [[fake_dep, dep1_dep]], |
||||
install : true, |
||||
build_by_default : true, |
||||
+ # Test that unknown kwargs do not crash the parser. |
||||
+ # Unknown kwargs will eventually become a hard error. |
||||
+ # Once that happens remove this. |
||||
+ unknown_kwarg : true, |
||||
) |
||||
|
||||
test('gobject introspection/c', girexe) |
||||
diff --git a/test cases/unit/22 warning location/meson.build b/test cases/unit/22 warning location/meson.build |
||||
index 132939e04..52a93d18c 100644 |
||||
--- a/test cases/unit/22 warning location/meson.build |
||||
+++ b/test cases/unit/22 warning location/meson.build |
||||
@@ -1,4 +1,4 @@ |
||||
-project('warning location', 'c') |
||||
+project('warning location', 'c', invalid: 'cheese') |
||||
a = library('liba', 'a.c') |
||||
b = library('libb', 'b.c') |
||||
executable('main', 'main.c', link_with: a, link_with: b) |
||||
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py |
||||
index 0b968e7cf..6ba95b652 100644 |
||||
--- a/unittests/allplatformstests.py |
||||
+++ b/unittests/allplatformstests.py |
||||
@@ -1931,6 +1931,7 @@ class AllPlatformTests(BasePlatformTests): |
||||
r'sub' + os.path.sep + r'meson.build:4: WARNING: subdir warning', |
||||
r'meson.build:7: WARNING: Module unstable-simd has no backwards or forwards compatibility and might not exist in future releases.', |
||||
r"meson.build:11: WARNING: The variable(s) 'MISSING' in the input file 'conf.in' are not present in the given configuration data.", |
||||
+ r'meson.build:1: WARNING: Passed invalid keyword argument "invalid".', |
||||
]: |
||||
self.assertRegex(out, re.escape(expected)) |
||||
|
||||
@@ -1980,9 +1981,8 @@ class AllPlatformTests(BasePlatformTests): |
||||
|
||||
def test_permitted_method_kwargs(self): |
||||
tdir = os.path.join(self.unit_test_dir, '25 non-permitted kwargs') |
||||
- with self.assertRaises(subprocess.CalledProcessError) as cm: |
||||
- self.init(tdir) |
||||
- self.assertIn('ERROR: compiler.has_header_symbol got unknown keyword arguments "prefixxx"', cm.exception.output) |
||||
+ out = self.init(tdir, allow_fail=True) |
||||
+ self.assertIn('Function does not take keyword arguments.', out) |
||||
|
||||
def test_templates(self): |
||||
ninja = mesonbuild.environment.detect_ninja() |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
From b705e45c48b79348bbb70fddc06b408a19ecedc7 Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 2 Nov 2022 10:08:52 +0100 |
||||
Subject: [PATCH 3/9] Revert "coredata: throw a MesonException on unknown |
||||
options" |
||||
Content-Type: text/plain |
||||
|
||||
This reverts commit dbf2ace6ca1ce39aa01497f815b65856079cc581. |
||||
--- |
||||
mesonbuild/coredata.py | 15 ++++++++------- |
||||
unittests/allplatformstests.py | 8 +++----- |
||||
2 files changed, 11 insertions(+), 12 deletions(-) |
||||
|
||||
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py |
||||
index f34694281..b274a5777 100644 |
||||
--- a/mesonbuild/coredata.py |
||||
+++ b/mesonbuild/coredata.py |
||||
@@ -803,7 +803,7 @@ class CoreData: |
||||
except KeyError: |
||||
continue |
||||
|
||||
- def set_options(self, options: T.Dict[OptionKey, T.Any], subproject: str = '') -> None: |
||||
+ def set_options(self, options: T.Dict[OptionKey, T.Any], subproject: str = '', warn_unknown: bool = True) -> None: |
||||
if not self.is_cross_build(): |
||||
options = {k: v for k, v in options.items() if k.machine is not MachineChoice.BUILD} |
||||
# Set prefix first because it's needed to sanitize other options |
||||
@@ -819,15 +819,16 @@ class CoreData: |
||||
for k, v in options.items(): |
||||
if k == pfk: |
||||
continue |
||||
- elif k in self.options: |
||||
- self.set_option(k, v) |
||||
- elif k.machine != MachineChoice.BUILD: |
||||
+ elif k not in self.options: |
||||
unknown_options.append(k) |
||||
- if unknown_options: |
||||
+ else: |
||||
+ self.set_option(k, v) |
||||
+ if unknown_options and warn_unknown: |
||||
unknown_options_str = ', '.join(sorted(str(s) for s in unknown_options)) |
||||
sub = f'In subproject {subproject}: ' if subproject else '' |
||||
- raise MesonException(f'{sub}Unknown options: "{unknown_options_str}"') |
||||
- |
||||
+ mlog.warning(f'{sub}Unknown options: "{unknown_options_str}"') |
||||
+ mlog.log('The value of new options can be set with:') |
||||
+ mlog.log(mlog.bold('meson setup <builddir> --reconfigure -Dnew_option=new_value ...')) |
||||
if not self.is_cross_build(): |
||||
self.copy_build_options_from_regular_ones() |
||||
|
||||
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py |
||||
index 6ba95b652..f848cc547 100644 |
||||
--- a/unittests/allplatformstests.py |
||||
+++ b/unittests/allplatformstests.py |
||||
@@ -2297,11 +2297,9 @@ class AllPlatformTests(BasePlatformTests): |
||||
self.assertEqual(obj.options[OptionKey('default_library')].value, 'shared') |
||||
self.wipe() |
||||
|
||||
- # Should fail on unknown options |
||||
- with self.assertRaises((subprocess.CalledProcessError, RuntimeError)) as cm: |
||||
- self.init(testdir, extra_args=['-Dbad=1', '-Dfoo=2', '-Dwrong_link_args=foo']) |
||||
- self.assertNotEqual(0, cm.exception.returncode) |
||||
- self.assertIn(msg, cm.exception.output) |
||||
+ # Should warn on unknown options |
||||
+ out = self.init(testdir, extra_args=['-Dbad=1', '-Dfoo=2', '-Dwrong_link_args=foo']) |
||||
+ self.assertIn('Unknown options: "bad, foo, wrong_link_args"', out) |
||||
self.wipe() |
||||
|
||||
# Should fail on malformed option |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
From 4e6fe24a702b58117e282cf8c9eb612d4e85cd83 Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 2 Nov 2022 10:24:39 +0100 |
||||
Subject: [PATCH 4/9] warn on equality/inequality with different types |
||||
Content-Type: text/plain |
||||
|
||||
--- |
||||
mesonbuild/interpreterbase/baseobjects.py | 18 ++++++++++-------- |
||||
1 file changed, 10 insertions(+), 8 deletions(-) |
||||
|
||||
diff --git a/mesonbuild/interpreterbase/baseobjects.py b/mesonbuild/interpreterbase/baseobjects.py |
||||
index a65b0536d..67f294387 100644 |
||||
--- a/mesonbuild/interpreterbase/baseobjects.py |
||||
+++ b/mesonbuild/interpreterbase/baseobjects.py |
||||
@@ -12,7 +12,7 @@ |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
-from .. import mparser |
||||
+from .. import mparser, mlog |
||||
from .exceptions import InvalidCode, InvalidArguments |
||||
from .helpers import flatten, resolve_second_level_holders |
||||
from .operator import MesonOperator |
||||
@@ -98,6 +98,9 @@ class InterpreterObject: |
||||
if op[0] is None and other is not None: |
||||
raise MesonBugException(f'The unary operator `{operator.value}` of {self.display_name()} was passed the object {other} of type {type(other).__name__}') |
||||
if op[0] is not None and not isinstance(other, op[0]): |
||||
+ if operator in (MesonOperator.EQUALS, MesonOperator.NOT_EQUALS): |
||||
+ mlog.warning(f'Trying to compare values of different types ({self.display_name()}, {type(other).__name__})') |
||||
+ return operator == MesonOperator.NOT_EQUALS |
||||
raise InvalidArguments(f'The `{operator.value}` operator of {self.display_name()} does not accept objects of type {type(other).__name__} ({other})') |
||||
return op[1](other) |
||||
if operator in self.operators: |
||||
@@ -106,12 +109,8 @@ class InterpreterObject: |
||||
|
||||
# Default comparison operator support |
||||
def _throw_comp_exception(self, other: TYPE_var, opt_type: str) -> T.NoReturn: |
||||
- raise InvalidArguments(textwrap.dedent( |
||||
- f''' |
||||
- Trying to compare values of different types ({self.display_name()}, {type(other).__name__}) using {opt_type}. |
||||
- This was deprecated and undefined behavior previously and is as of 0.60.0 a hard error. |
||||
- ''' |
||||
- )) |
||||
+ mlog.warning( |
||||
+ 'Trying to compare values of different types ({self.display_name()}, {type(other).__name__}) using {opt_type}.') |
||||
|
||||
def op_equals(self, other: TYPE_var) -> bool: |
||||
# We use `type(...) == type(...)` here to enforce an *exact* match for comparison. We |
||||
@@ -119,11 +118,12 @@ class InterpreterObject: |
||||
# would pass because this comparison must never be true: `derived_obj == base_obj` |
||||
if type(self) != type(other): |
||||
self._throw_comp_exception(other, '==') |
||||
+ return False |
||||
return self == other |
||||
|
||||
def op_not_equals(self, other: TYPE_var) -> bool: |
||||
if type(self) != type(other): |
||||
- self._throw_comp_exception(other, '!=') |
||||
+ return True |
||||
return self != other |
||||
|
||||
class MesonInterpreterObject(InterpreterObject): |
||||
@@ -157,11 +157,13 @@ class ObjectHolder(InterpreterObject, T.Generic[InterpreterObjectTypeVar]): |
||||
# See the comment from InterpreterObject why we are using `type()` here. |
||||
if type(self.held_object) != type(other): |
||||
self._throw_comp_exception(other, '==') |
||||
+ return False |
||||
return self.held_object == other |
||||
|
||||
def op_not_equals(self, other: TYPE_var) -> bool: |
||||
if type(self.held_object) != type(other): |
||||
self._throw_comp_exception(other, '!=') |
||||
+ return True |
||||
return self.held_object != other |
||||
|
||||
def __repr__(self) -> str: |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
From 1e50e285732925c417377cb78e53d075f134ca70 Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 2 Nov 2022 10:06:40 +0100 |
||||
Subject: [PATCH 5/9] accept positional arguments for i18n.merge_file |
||||
Content-Type: text/plain |
||||
|
||||
Partial revert of upstream commit 61f2866a9f with a warning added. |
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
||||
--- |
||||
mesonbuild/modules/i18n.py | 5 ++++- |
||||
1 file changed, 4 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py |
||||
index 524a33110..f8d92d211 100644 |
||||
--- a/mesonbuild/modules/i18n.py |
||||
+++ b/mesonbuild/modules/i18n.py |
||||
@@ -146,7 +146,6 @@ class I18nModule(ExtensionModule): |
||||
return [path.join(src_dir, d) for d in dirs] |
||||
|
||||
@FeatureNew('i18n.merge_file', '0.37.0') |
||||
- @noPosargs |
||||
@typed_kwargs( |
||||
'i18n.merge_file', |
||||
CT_BUILD_BY_DEFAULT, |
||||
@@ -161,6 +160,10 @@ class I18nModule(ExtensionModule): |
||||
KwargInfo('type', str, default='xml', validator=in_set_validator({'xml', 'desktop'})), |
||||
) |
||||
def merge_file(self, state: 'ModuleState', args: T.List['TYPE_var'], kwargs: 'MergeFile') -> ModuleReturnValue: |
||||
+ if args: |
||||
+ mlog.warning('i18n.merge_file() does not take any ' |
||||
+ 'positional arguments. This will become an error in the future.', |
||||
+ location=self.interpreter.current_node) |
||||
if self.tools['msgfmt'] is None or not self.tools['msgfmt'].found(): |
||||
self.tools['msgfmt'] = state.find_program('msgfmt', for_machine=mesonlib.MachineChoice.BUILD) |
||||
podir = path.join(state.build_to_src, state.subdir, kwargs['po_dir']) |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,144 @@
@@ -0,0 +1,144 @@
|
||||
From e03c6d8be0e07dc0a5295867acd3bcde8852d5ba Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 5 Oct 2022 16:40:09 +0200 |
||||
Subject: [PATCH 6/9] gnome: allow custom targets as gdbus-codegen inputs |
||||
Content-Type: text/plain |
||||
|
||||
Custom targets as sources to `gnome.gdbus_codegen` worked until version 0.60 |
||||
of Meson, but broke in 0.61 because of the conversion to typed_pos_args |
||||
and typed_kwargs. Reinstate this by adding custom targets to the |
||||
decorators and annotations. |
||||
|
||||
While generators also used to work, they are a bit tricky because |
||||
gdbus_codegen desugars to two custom_targets and therefore the generator |
||||
is invoked twice. This should not be a problem, but be explicit and |
||||
leave that to a separate commit to highlight the problem. |
||||
|
||||
Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01) |
||||
Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08) |
||||
--- |
||||
mesonbuild/modules/gnome.py | 8 +++---- |
||||
test cases/frameworks/7 gnome/copyfile.py | 6 ++++++ |
||||
.../frameworks/7 gnome/gdbus/meson.build | 21 +++++++++++++++++++ |
||||
test cases/frameworks/7 gnome/meson.build | 2 ++ |
||||
.../frameworks/7 gnome/resources/copyfile.py | 6 ------ |
||||
.../frameworks/7 gnome/resources/meson.build | 2 -- |
||||
6 files changed, 33 insertions(+), 12 deletions(-) |
||||
create mode 100644 test cases/frameworks/7 gnome/copyfile.py |
||||
delete mode 100644 test cases/frameworks/7 gnome/resources/copyfile.py |
||||
|
||||
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py |
||||
index 25cea6938..00feba45c 100644 |
||||
--- a/mesonbuild/modules/gnome.py |
||||
+++ b/mesonbuild/modules/gnome.py |
||||
@@ -1556,11 +1556,11 @@ class GnomeModule(ExtensionModule): |
||||
def gtkdoc_html_dir(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'TYPE_kwargs') -> str: |
||||
return os.path.join('share/gtk-doc/html', args[0]) |
||||
|
||||
- @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File)]) |
||||
+ @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)]) |
||||
@typed_kwargs( |
||||
'gnome.gdbus_codegen', |
||||
_BUILD_BY_DEFAULT.evolve(since='0.40.0'), |
||||
- KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File)), since='0.46.0', default=[], listify=True), |
||||
+ KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)), since='0.46.0', default=[], listify=True), |
||||
KwargInfo('extra_args', ContainerTypeInfo(list, str), since='0.47.0', default=[], listify=True), |
||||
KwargInfo('interface_prefix', (str, NoneType)), |
||||
KwargInfo('namespace', (str, NoneType)), |
||||
@@ -1578,10 +1578,10 @@ class GnomeModule(ExtensionModule): |
||||
validator=in_set_validator({'all', 'none', 'objects'})), |
||||
INSTALL_DIR_KW.evolve(since='0.46.0') |
||||
) |
||||
- def gdbus_codegen(self, state: 'ModuleState', args: T.Tuple[str, T.Optional['FileOrString']], |
||||
+ def gdbus_codegen(self, state: 'ModuleState', args: T.Tuple[str, T.Optional[T.Union['FileOrString', 'build.GeneratedTypes']]], |
||||
kwargs: 'GdbusCodegen') -> ModuleReturnValue: |
||||
namebase = args[0] |
||||
- xml_files: T.List['FileOrString'] = [args[1]] if args[1] else [] |
||||
+ xml_files: T.List[T.Union['FileOrString', 'build.GeneratedTypes']] = [args[1]] if args[1] else [] |
||||
cmd: T.List[T.Union['ExternalProgram', str]] = [state.find_program('gdbus-codegen')] |
||||
cmd.extend(kwargs['extra_args']) |
||||
|
||||
diff --git a/test cases/frameworks/7 gnome/copyfile.py b/test cases/frameworks/7 gnome/copyfile.py |
||||
new file mode 100644 |
||||
index 000000000..7e44c48dd |
||||
--- /dev/null |
||||
+++ b/test cases/frameworks/7 gnome/copyfile.py |
||||
@@ -0,0 +1,6 @@ |
||||
+#!/usr/bin/env python3 |
||||
+ |
||||
+import sys |
||||
+import shutil |
||||
+ |
||||
+shutil.copy(sys.argv[1], sys.argv[2]) |
||||
diff --git a/test cases/frameworks/7 gnome/gdbus/meson.build b/test cases/frameworks/7 gnome/gdbus/meson.build |
||||
index 682abfffe..d749033e9 100644 |
||||
--- a/test cases/frameworks/7 gnome/gdbus/meson.build |
||||
+++ b/test cases/frameworks/7 gnome/gdbus/meson.build |
||||
@@ -58,6 +58,27 @@ else |
||||
includes = include_directories('..') |
||||
endif |
||||
|
||||
+# check that custom targets work |
||||
+gdbus_xml_ct = custom_target('built xml sources for gdbus', |
||||
+ output: 'com.example.SampleCustomTarget.xml', |
||||
+ input: 'data/com.example.Sample.xml', |
||||
+ command : [copyfile, '@INPUT@', '@OUTPUT@']) |
||||
+ |
||||
+gdbus_src_ct = gnome.gdbus_codegen( |
||||
+ 'generated-gdbus-customtarget-src', |
||||
+ gdbus_xml_ct, |
||||
+ interface_prefix : 'com.example.', |
||||
+ namespace : 'Sample', |
||||
+ annotations : [], |
||||
+) |
||||
+gdbus_src_cti = gnome.gdbus_codegen( |
||||
+ 'generated-gdbus-customtargetindex-src', |
||||
+ gdbus_xml_ct[0], |
||||
+ interface_prefix : 'com.example.', |
||||
+ namespace : 'Sample', |
||||
+ annotations : [], |
||||
+) |
||||
+ |
||||
gdbus_exe = executable('gdbus-test', 'gdbusprog.c', |
||||
gdbus_src, |
||||
include_directories : includes, |
||||
diff --git a/test cases/frameworks/7 gnome/meson.build b/test cases/frameworks/7 gnome/meson.build |
||||
index 9f8640609..920bc6a82 100644 |
||||
--- a/test cases/frameworks/7 gnome/meson.build |
||||
+++ b/test cases/frameworks/7 gnome/meson.build |
||||
@@ -1,5 +1,7 @@ |
||||
project('gobject-introspection', 'c') |
||||
|
||||
+copyfile = find_program('copyfile.py') |
||||
+ |
||||
glib = dependency('glib-2.0', required: false) |
||||
if not glib.found() |
||||
error('MESON_SKIP_TEST glib not found.') |
||||
diff --git a/test cases/frameworks/7 gnome/resources/copyfile.py b/test cases/frameworks/7 gnome/resources/copyfile.py |
||||
deleted file mode 100644 |
||||
index 7e44c48dd..000000000 |
||||
--- a/test cases/frameworks/7 gnome/resources/copyfile.py |
||||
+++ /dev/null |
||||
@@ -1,6 +0,0 @@ |
||||
-#!/usr/bin/env python3 |
||||
- |
||||
-import sys |
||||
-import shutil |
||||
- |
||||
-shutil.copy(sys.argv[1], sys.argv[2]) |
||||
diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build |
||||
index 180b33851..60fc8481e 100644 |
||||
--- a/test cases/frameworks/7 gnome/resources/meson.build |
||||
+++ b/test cases/frameworks/7 gnome/resources/meson.build |
||||
@@ -1,8 +1,6 @@ |
||||
# There are two tests here, because the 2nd one depends on a version of |
||||
# GLib (2.51.1) that is very recent at the time of writing. |
||||
|
||||
-copyfile = find_program('copyfile.py') |
||||
- |
||||
simple_gresource = configure_file( |
||||
input : 'simple.gresource.xml', |
||||
output : 'simple-gen.gresource.xml', |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
From 84b2ea237d30a1c93f179d0bc44731ae7962910e Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Wed, 5 Oct 2022 16:40:48 +0200 |
||||
Subject: [PATCH 7/9] gnome: allow generator outputs as gdbus-codegen inputs |
||||
Content-Type: text/plain |
||||
|
||||
GeneratedLists as sources to `gnome.gdbus_codegen` worked until |
||||
version 0.60 of Meson, but broke in 0.61 because of the conversion to |
||||
typed_pos_args and typed_kwargs. Reinstate this by adding them to the |
||||
decorators and annotations. |
||||
|
||||
Note that gdbus_codegen desugars to two custom_targets and therefore the |
||||
generator is invoked twice. This is not optimal, but it should not be |
||||
an issue and can be changed later. |
||||
|
||||
Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01) |
||||
Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08) |
||||
--- |
||||
mesonbuild/modules/gnome.py | 6 +++--- |
||||
test cases/frameworks/7 gnome/gdbus/meson.build | 8 ++++++++ |
||||
test cases/frameworks/7 gnome/meson.build | 3 +++ |
||||
3 files changed, 14 insertions(+), 3 deletions(-) |
||||
|
||||
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py |
||||
index 00feba45c..d8669bb48 100644 |
||||
--- a/mesonbuild/modules/gnome.py |
||||
+++ b/mesonbuild/modules/gnome.py |
||||
@@ -32,7 +32,7 @@ from .. import mesonlib |
||||
from .. import mlog |
||||
from ..build import CustomTarget, CustomTargetIndex, Executable, GeneratedList, InvalidArguments |
||||
from ..dependencies import Dependency, PkgConfigDependency, InternalDependency |
||||
-from ..interpreter.type_checking import DEPENDS_KW, DEPEND_FILES_KW, INSTALL_DIR_KW, INSTALL_KW, NoneType, in_set_validator |
||||
+from ..interpreter.type_checking import DEPENDS_KW, DEPEND_FILES_KW, INSTALL_DIR_KW, INSTALL_KW, NoneType, SOURCES_KW, in_set_validator |
||||
from ..interpreterbase import noPosargs, noKwargs, FeatureNew, FeatureDeprecated |
||||
from ..interpreterbase import typed_kwargs, KwargInfo, ContainerTypeInfo |
||||
from ..interpreterbase.decorators import typed_pos_args |
||||
@@ -1556,11 +1556,11 @@ class GnomeModule(ExtensionModule): |
||||
def gtkdoc_html_dir(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'TYPE_kwargs') -> str: |
||||
return os.path.join('share/gtk-doc/html', args[0]) |
||||
|
||||
- @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)]) |
||||
+ @typed_pos_args('gnome.gdbus_codegen', str, optargs=[(str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)]) |
||||
@typed_kwargs( |
||||
'gnome.gdbus_codegen', |
||||
_BUILD_BY_DEFAULT.evolve(since='0.40.0'), |
||||
- KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)), since='0.46.0', default=[], listify=True), |
||||
+ SOURCES_KW.evolve(since='0.46.0'), |
||||
KwargInfo('extra_args', ContainerTypeInfo(list, str), since='0.47.0', default=[], listify=True), |
||||
KwargInfo('interface_prefix', (str, NoneType)), |
||||
KwargInfo('namespace', (str, NoneType)), |
||||
diff --git a/test cases/frameworks/7 gnome/gdbus/meson.build b/test cases/frameworks/7 gnome/gdbus/meson.build |
||||
index d749033e9..fdb3896ca 100644 |
||||
--- a/test cases/frameworks/7 gnome/gdbus/meson.build |
||||
+++ b/test cases/frameworks/7 gnome/gdbus/meson.build |
||||
@@ -79,6 +79,14 @@ gdbus_src_cti = gnome.gdbus_codegen( |
||||
annotations : [], |
||||
) |
||||
|
||||
+gdbus_src_gen = gnome.gdbus_codegen( |
||||
+ 'generated-gdbus-generator-src', |
||||
+ copyfile_gen.process('data/com.example.Sample.xml'), |
||||
+ interface_prefix : 'com.example.', |
||||
+ namespace : 'Sample', |
||||
+ annotations : [], |
||||
+) |
||||
+ |
||||
gdbus_exe = executable('gdbus-test', 'gdbusprog.c', |
||||
gdbus_src, |
||||
include_directories : includes, |
||||
diff --git a/test cases/frameworks/7 gnome/meson.build b/test cases/frameworks/7 gnome/meson.build |
||||
index 920bc6a82..5f438cb67 100644 |
||||
--- a/test cases/frameworks/7 gnome/meson.build |
||||
+++ b/test cases/frameworks/7 gnome/meson.build |
||||
@@ -1,6 +1,9 @@ |
||||
project('gobject-introspection', 'c') |
||||
|
||||
copyfile = find_program('copyfile.py') |
||||
+copyfile_gen = generator(copyfile, |
||||
+ output: '@BASENAME@Gen.xml', |
||||
+ arguments : ['@INPUT@', '@OUTPUT@']) |
||||
|
||||
glib = dependency('glib-2.0', required: false) |
||||
if not glib.found() |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
From 783c55103daac6240dd4117a14873df0ac038cf6 Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Thu, 3 Nov 2022 12:13:10 +0100 |
||||
Subject: [PATCH 8/9] Revert "use shared implementation to convert files() |
||||
strings to File objects" |
||||
Content-Type: text/plain |
||||
|
||||
This reverts commit e6e8159980e9a4c816223fcdac8c729d104c0c02. |
||||
It causes a failure to build gtk-vnc. |
||||
--- |
||||
mesonbuild/interpreter/interpreter.py | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py |
||||
index b52a55890..caf28f8bd 100644 |
||||
--- a/mesonbuild/interpreter/interpreter.py |
||||
+++ b/mesonbuild/interpreter/interpreter.py |
||||
@@ -645,7 +645,7 @@ class Interpreter(InterpreterBase, HoldableObject): |
||||
@typed_pos_args('files', varargs=str) |
||||
@noKwargs |
||||
def func_files(self, node: mparser.FunctionNode, args: T.Tuple[T.List[str]], kwargs: 'TYPE_kwargs') -> T.List[mesonlib.File]: |
||||
- return self.source_strings_to_files(args[0]) |
||||
+ return [mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, fname) for fname in args[0]] |
||||
|
||||
# Used by pkgconfig.generate() |
||||
def extract_variables(self, kwargs: T.Dict[str, T.Union[T.Dict[str, str], T.List[str], str]], |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
From 8c0af255ff937329931372b33335ec580a8e9daa Mon Sep 17 00:00:00 2001 |
||||
From: Paolo Bonzini <pbonzini@redhat.com> |
||||
Date: Thu, 3 Nov 2022 17:49:25 +0100 |
||||
Subject: [PATCH 9/9] gnome: allow duplicated languages for gnome.yelp |
||||
Content-Type: text/plain |
||||
|
||||
This fixes building Glade 3.38.2. |
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
||||
--- |
||||
mesonbuild/modules/gnome.py | 5 +++++ |
||||
1 file changed, 5 insertions(+) |
||||
|
||||
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py |
||||
index d8669bb48..98ec8a5ca 100644 |
||||
--- a/mesonbuild/modules/gnome.py |
||||
+++ b/mesonbuild/modules/gnome.py |
||||
@@ -1303,7 +1303,12 @@ class GnomeModule(ExtensionModule): |
||||
state.environment) |
||||
targets.append(pottarget) |
||||
|
||||
+ langs_done = set() |
||||
for l in langs: |
||||
+ if l in langs_done: |
||||
+ mlog.warning(f'duplicate language "{l}" in LINGUAS file') |
||||
+ continue |
||||
+ langs_done.add(l) |
||||
l_subdir = os.path.join(state.subdir, l) |
||||
l_install_dir = os.path.join(install_dir, l, project_id) |
||||
|
||||
-- |
||||
2.38.1 |
||||
|
Loading…
Reference in new issue