Fix install_subdirs not showing up in intro-install_plan.json

pull/10784/head
Thomas Li 2 years ago committed by Eli Schwartz
parent e6122ba786
commit a4d5442207
  1. 4
      mesonbuild/backend/backends.py
  2. 1
      mesonbuild/build.py
  3. 5
      mesonbuild/interpreter/interpreter.py
  4. 4
      mesonbuild/mintro.py
  5. 1
      mesonbuild/modules/external_project.py
  6. 6
      unittests/allplatformstests.py

@ -1754,9 +1754,11 @@ class Backend:
dst_dir = os.path.join(self.environment.get_prefix(),
sd.install_dir)
dst_name = os.path.join('{prefix}', sd.install_dir)
if sd.install_dir != sd.install_dir_name:
dst_name = sd.install_dir_name
if not sd.strip_directory:
dst_dir = os.path.join(dst_dir, os.path.basename(src_dir))
dst_name = os.path.join(dst_dir, os.path.basename(src_dir))
dst_name = os.path.join(dst_name, os.path.basename(src_dir))
i = SubdirInstallData(src_dir, dst_dir, dst_name, sd.install_mode, sd.exclude, sd.subproject, sd.install_tag)
d.install_subdirs.append(i)

@ -204,6 +204,7 @@ class InstallDir(HoldableObject):
source_subdir: str
installable_subdir: str
install_dir: str
install_dir_name: str
install_mode: 'FileMode'
exclude: T.Tuple[T.Set[str], T.Set[str]]
strip_directory: bool

@ -2419,10 +2419,15 @@ class Interpreter(InterpreterBase, HoldableObject):
'It worked by accident and is buggy. Use install_emptydir instead.', node)
install_mode = self._warn_kwarg_install_mode_sticky(kwargs['install_mode'])
idir_name = kwargs['install_dir']
if isinstance(idir_name, P_OBJ.OptionString):
idir_name = idir_name.optname
idir = build.InstallDir(
self.subdir,
args[0],
kwargs['install_dir'],
idir_name,
install_mode,
exclude,
kwargs['strip_directory'],

@ -137,8 +137,10 @@ def list_install_plan(installdata: backends.InstallData) -> T.Dict[str, T.Dict[s
'data': installdata.data,
'man': installdata.man,
'headers': installdata.headers,
'install_subdirs': installdata.install_subdirs
}.items():
for data in data_list:
# Mypy doesn't recognize SubdirInstallData as a subclass of InstallDataBase
for data in data_list: # type: ignore[attr-defined]
data_type = data.data_type or key
install_path_name = data.install_path_name
if key == 'headers': # in the headers, install_path_name is the directory

@ -245,6 +245,7 @@ class ExternalProject(NewExtensionModule):
idir = build.InstallDir(self.subdir.as_posix(),
Path('dist', self.rel_prefix).as_posix(),
install_dir='.',
install_dir_name='.',
install_mode=None,
exclude=None,
strip_directory=True,

@ -4290,6 +4290,12 @@ class AllPlatformTests(BasePlatformTests):
'destination': '{includedir}/foo3-devel.h',
'tag': 'devel',
},
},
'install_subdirs': {
f'{testdir}/custom_files': {
'destination': '{datadir}/custom_files',
'tag': 'custom'
}
}
}

Loading…
Cancel
Save