aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-03-09 15:43:26 -0800
committerEli Schwartz <eschwartz93@gmail.com>2022-08-18 21:57:36 -0400
commit2fb0c0e4d8c7f325ae683c1cc8a5664b32585b33 (patch)
tree44e4d40f4ff4111301fb2119a4b120969a9ea3a3
parente15f15d90426aee0efd63e811a4719022b8ecfcf (diff)
downloadmeson-2fb0c0e4d8c7f325ae683c1cc8a5664b32585b33.zip
meson-2fb0c0e4d8c7f325ae683c1cc8a5664b32585b33.tar.gz
meson-2fb0c0e4d8c7f325ae683c1cc8a5664b32585b33.tar.bz2
modules/pkgconfig: remove type checking abstraction
Which confuses the heck out of mypy
-rw-r--r--mesonbuild/modules/pkgconfig.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index 859ac3f..87cacf8 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -372,8 +372,8 @@ class PkgConfigModule(ExtensionModule):
})
def _get_lname(self, l: T.Union[build.SharedLibrary, build.StaticLibrary, build.CustomTarget, build.CustomTargetIndex],
- msg: str, pcfile: str, is_custom_target: bool) -> str:
- if is_custom_target:
+ msg: str, pcfile: str) -> str:
+ if isinstance(l, (build.CustomTargetIndex, build.CustomTarget)):
basename = os.path.basename(l.get_filename())
name = os.path.splitext(basename)[0]
if name.startswith('lib'):
@@ -530,8 +530,7 @@ class PkgConfigModule(ExtensionModule):
install_dir = _i[0] if _i else None
if install_dir is False:
continue
- is_custom_target = isinstance(l, (build.CustomTarget, build.CustomTargetIndex))
- if not is_custom_target and 'cs' in l.compilers:
+ if isinstance(l, build.BuildTarget) and 'cs' in l.compilers:
if isinstance(install_dir, str):
Lflag = '-r{}/{}'.format(self._escape(self._make_relative(prefix, install_dir)), l.filename)
else: # install_dir is True
@@ -544,12 +543,12 @@ class PkgConfigModule(ExtensionModule):
if Lflag not in Lflags:
Lflags.append(Lflag)
yield Lflag
- lname = self._get_lname(l, msg, pcfile, is_custom_target)
+ lname = self._get_lname(l, msg, pcfile)
# If using a custom suffix, the compiler may not be able to
# find the library
- if not is_custom_target and l.name_suffix_set:
+ if isinstance(l, build.BuildTarget) and l.name_suffix_set:
mlog.warning(msg.format(l.name, 'name_suffix', lname, pcfile))
- if is_custom_target or 'cs' not in l.compilers:
+ if isinstance(l, (build.CustomTarget, build.CustomTargetIndex)) or 'cs' not in l.compilers:
yield f'-l{lname}'
def get_uninstalled_include_dirs(libs: T.List[LIBS]) -> T.List[str]:
@@ -644,7 +643,7 @@ class PkgConfigModule(ExtensionModule):
if dataonly:
default_subdirs = []
blocked_vars = ['libraries', 'libraries_private', 'requires_private', 'extra_cflags', 'subdirs']
- if any(kwargs[k] for k in blocked_vars):
+ if any(kwargs[k] for k in blocked_vars): # type: ignore
raise mesonlib.MesonException(f'Cannot combine dataonly with any of {blocked_vars}')
default_install_dir = os.path.join(state.environment.get_datadir(), 'pkgconfig')