Skip to content

Commit

Permalink
wayland: support vendored protocols.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericonr committed Sep 28, 2024
1 parent b7ce7c2 commit bc5bad2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mesonbuild/modules/wayland.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ def scan_xml(self, state: ModuleState, args: T.Tuple[T.List[FileOrString]], kwar
'wayland.find_protocol',
KwargInfo('state', str, default='stable', validator=in_set_validator({'stable', 'staging', 'unstable'})),
KwargInfo('version', (int, NoneType)),
KwargInfo('vendored', bool, default=False, since='1.6.0'),
)
def find_protocol(self, state: ModuleState, args: T.Tuple[str], kwargs: FindProtocol) -> File:
base_name = args[0]
xml_state = kwargs['state']
version = kwargs['version']
vendored = kwargs['vendored']

if xml_state != 'stable' and version is None:
raise MesonException(f'{xml_state} protocols require a version number.')
Expand All @@ -137,7 +139,10 @@ def find_protocol(self, state: ModuleState, args: T.Tuple[str], kwargs: FindProt
xml_name += f'-v{version}'
xml_name += '.xml'

path = os.path.join(self.pkgdatadir, xml_state, base_name, xml_name)
if vendored:
path = os.path.join(self.interpreter.subdir, xml_name)
else:
path = os.path.join(self.pkgdatadir, xml_state, base_name, xml_name)

if not os.path.exists(path):
raise MesonException(f'The file {path} does not exist.')
Expand Down

0 comments on commit bc5bad2

Please sign in to comment.