diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-03-06 11:09:48 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-03-09 11:57:26 -0700 |
commit | 5ccda6878d3b8f494d65dfc084ba1a884329d57a (patch) | |
tree | f8258a53524f23c8af711ae654ec04d267195e20 /run_project_tests.py | |
parent | ef1c6cdd543a44b6cfd1e86175ce64f2d742c415 (diff) | |
download | meson-5ccda6878d3b8f494d65dfc084ba1a884329d57a.zip meson-5ccda6878d3b8f494d65dfc084ba1a884329d57a.tar.gz meson-5ccda6878d3b8f494d65dfc084ba1a884329d57a.tar.bz2 |
project_tests: Add "version" to "shared_lib" and "pdb" types
This allows the harness to apply the version correctly, putting it in the right
place, dropping the right amount of numbers, etc.
pdb taking a version allows it to be more easily copied from the
shared_lib type.
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-x | run_project_tests.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index d63dd38..160fbf3 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -95,6 +95,13 @@ class InstalledFile: self.typ = raw['type'] self.platform = raw.get('platform', None) + version = raw.get('version', '') # type: str + if version: + self.version = version.split('.') # type: T.List[str] + else: + # split on '' will return [''], we want an empty list though + self.version = [] + def get_path(self, compiler: str, env: environment.Environment) -> T.Optional[Path]: p = Path(self.path) canonical_compiler = compiler @@ -116,17 +123,35 @@ class InstalledFile: return p elif self.typ == 'shared_lib': if env.machines.host.is_windows() or env.machines.host.is_cygwin(): + # Windows only has foo.dll and foo-X.dll + if len(self.version) > 1: + return None + if self.version: + p = p.with_name('{}-{}'.format(p.name, self.version[0])) return p.with_suffix('.dll') p = p.with_name('lib{}'.format(p.name)) if env.machines.host.is_darwin(): - return p.with_suffix('.dylib') + # MacOS only has libfoo.dylib and libfoo.X.dylib + if len(self.version) > 1: + return None + + # pathlib.Path.with_suffix replaces, not appends + suffix = '.dylib' + if self.version: + suffix = '.{}{}'.format(self.version[0], suffix) else: - return p.with_suffix('.so') + # pathlib.Path.with_suffix replaces, not appends + suffix = '.so' + if self.version: + suffix = '{}.{}'.format(suffix, '.'.join(self.version)) + return p.with_suffix(suffix) elif self.typ == 'exe': if env.machines.host.is_windows() or env.machines.host.is_cygwin(): return p.with_suffix('.exe') elif self.typ == 'pdb': + if self.version: + p = p.with_name('{}-{}'.format(p.name, self.version[0])) return p.with_suffix('.pdb') if canonical_compiler == 'msvc' else None elif self.typ == 'implib' or self.typ == 'implibempty': if env.machines.host.is_windows() and canonical_compiler == 'msvc': |