From df451f10130fc5d64cf1c65504a69bedd2fbdfdd Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 29 Jan 2022 19:54:15 +0100 Subject: meson: Allow directory options outside of prefix This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Also remove a comment about commonpath since we do not use that since . Fixes: https://github.com/mesonbuild/meson/issues/2561 --- unittests/allplatformstests.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'unittests') diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 60ff123..3eea9a3 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -213,9 +213,9 @@ class AllPlatformTests(BasePlatformTests): elif opt['name'] == 'libdir': self.assertEqual(libdir, opt['value']) - def test_libdir_must_be_inside_prefix(self): + def test_libdir_can_be_outside_prefix(self): ''' - Tests that libdir is forced to be inside prefix no matter how it is set. + Tests that libdir is allowed to be outside prefix. Must be a unit test for obvious reasons. ''' testdir = os.path.join(self.common_test_dir, '1 trivial') @@ -226,19 +226,19 @@ class AllPlatformTests(BasePlatformTests): args = ['--prefix', '/opt', '--libdir', '/opt/lib32'] self.init(testdir, extra_args=args) self.wipe() - # libdir not being inside prefix is not ok + # libdir not being inside prefix is ok too if is_windows(): args = ['--prefix', 'x:/usr', '--libdir', 'x:/opt/lib32'] else: args = ['--prefix', '/usr', '--libdir', '/opt/lib32'] - self.assertRaises(subprocess.CalledProcessError, self.init, testdir, extra_args=args) + self.init(testdir, extra_args=args) self.wipe() - # libdir must be inside prefix even when set via mesonconf + # libdir can be outside prefix even when set via mesonconf self.init(testdir) if is_windows(): - self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=x:/opt', False) + self.setconf('-Dlibdir=x:/opt', will_build=False) else: - self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=/opt', False) + self.setconf('-Dlibdir=/opt', will_build=False) def test_prefix_dependent_defaults(self): ''' -- cgit v1.1