summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/meson/meson/load-configs-generalise-search-path.patch
blob: fc02576f5bd0a2ab5d91ee17b2596bfadee9e401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From d57dd1092e84e08ee15d7063b6c56bd6d864f2e1 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Mon, 18 Mar 2019 16:16:56 +0000
Subject: [PATCH] load_configs: generalise the search path

Instead of hard-coding the fact that load_configs() searches for files under
meson/native, pass in the subdirectory allowing the cross-file code to use the
same logic.
---
 mesonbuild/coredata.py    | 6 +++---
 mesonbuild/environment.py | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index fba90fa369..6e60917d10 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -211,8 +211,8 @@ def is_auto(self):
         return self.value == 'auto'
 
 
-def load_configs(filenames):
-    """Load native files."""
+def load_configs(filenames, subdir):
+    """Load configuration files from a named subdirectory."""
     def gen():
         for f in filenames:
             f = os.path.expanduser(os.path.expandvars(f))
@@ -225,7 +225,7 @@ def gen():
                     os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')),
                 ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
                 for path in paths:
-                    path_to_try = os.path.join(path, 'meson', 'native', f)
+                    path_to_try = os.path.join(path, 'meson', subdir, f)
                     if os.path.isfile(path_to_try):
                         yield path_to_try
                         break
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 58adb06960..92a00dd7bf 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -408,7 +408,7 @@ def __init__(self, source_dir, build_dir, options):
 
         if self.coredata.config_files is not None:
             config = MesonConfigFile.from_config_parser(
-                coredata.load_configs(self.coredata.config_files))
+                coredata.load_configs(self.coredata.config_files, 'native'))
             self.binaries.build = BinaryTable(config.get('binaries', {}))
             self.paths.build = Directories(**config.get('paths', {}))