aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/coredata.py6
-rwxr-xr-xrun_unittests.py8
2 files changed, 10 insertions, 4 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 44eaa02..cdee20d 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -501,7 +501,7 @@ class CoreData:
# Create builtin options with default values
self.builtins = {}
for key, opt in builtin_options.items():
- self.builtins[key] = opt.init_option()
+ self.builtins[key] = opt.init_option(key, default_prefix())
self.builtins_per_machine = PerMachine({}, {})
for for_machine in iter(MachineChoice):
for key, opt in builtin_options_per_machine.items():
@@ -959,9 +959,9 @@ class BuiltinOption(T.Generic[_T, _U]):
self.choices = choices
self.yielding = yielding
- def init_option(self) -> _U:
+ def init_option(self, name: str = 'prefix', prefix: str = '') -> _U:
"""Create an instance of opt_type and return it."""
- keywords = {'yielding': self.yielding, 'value': self.default}
+ keywords = {'yielding': self.yielding, 'value': self.prefixed_default(name, prefix)}
if self.choices:
keywords['choices'] = self.choices
return self.opt_type(self.description, **keywords)
diff --git a/run_unittests.py b/run_unittests.py
index cf40955..d0cc68d 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1857,8 +1857,14 @@ class AllPlatformTests(BasePlatformTests):
# N.B. We don't check 'libdir' as it's platform dependent, see
# default_libdir():
}
+
+ if mesonbuild.mesonlib.default_prefix() == '/usr/local':
+ expected[None] = expected['/usr/local']
+
for prefix in expected:
- args = ['--prefix', prefix]
+ args = []
+ if prefix:
+ args += ['--prefix', prefix]
self.init(testdir, extra_args=args, default_args=False)
opts = self.introspect('--buildoptions')
for opt in opts: