summaryrefslogtreecommitdiff
path: root/mesonbuild/munstable_coredata.py
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-10-04 20:52:08 -0400
committerJohn Ericson <git@JohnEricson.me>2019-06-09 13:13:25 -0400
commit07777e15d47dbddaf849d24b3a30c85745c533ca (patch)
treef472472ed511498c329b4e13e19b1585e1afb621 /mesonbuild/munstable_coredata.py
parent32e827dcdc451e1c5dde952cf08e4b654eac7057 (diff)
downloadmeson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.gz
Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
Diffstat (limited to 'mesonbuild/munstable_coredata.py')
-rw-r--r--mesonbuild/munstable_coredata.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/mesonbuild/munstable_coredata.py b/mesonbuild/munstable_coredata.py
index 864df0411..d3cc1da50 100644
--- a/mesonbuild/munstable_coredata.py
+++ b/mesonbuild/munstable_coredata.py
@@ -14,6 +14,7 @@
from . import coredata as cdata
+from .mesonlib import MachineChoice
import os.path
import pprint
@@ -91,18 +92,11 @@ def run(options):
if v:
print('Native File: ' + ' '.join(v))
elif k == 'compilers':
- print('Cached native compilers:')
- dump_compilers(v)
- elif k == 'cross_compilers':
- print('Cached cross compilers:')
- dump_compilers(v)
+ for for_machine in MachineChoice:
+ print('Cached {} machine compilers:'.format(
+ for_machine.get_lower_case_name()))
+ dump_compilers(v[for_machine])
elif k == 'deps':
- native = list(sorted(v.build.items()))
- if v.host is not v.build:
- cross = list(sorted(v.host.items()))
- else:
- cross = []
-
def print_dep(dep_key, dep):
print(' ' + dep_key[0] + ": ")
print(' compile args: ' + repr(dep.get_compile_args()))
@@ -111,16 +105,13 @@ def run(options):
print(' sources: ' + repr(dep.get_sources()))
print(' version: ' + repr(dep.get_version()))
- if native:
- print('Cached native dependencies:')
- for dep_key, deps in native:
- for dep in deps:
- print_dep(dep_key, dep)
- if cross:
- print('Cached dependencies:')
- for dep_key, deps in cross:
- for dep in deps:
- print_dep(dep_key, dep)
+ for for_machine in iter(MachineChoice):
+ items_list = list(sorted(v[for_machine].items()))
+ if items_list:
+ print('Cached dependencies for {} machine' % for_machine.get_lower_case_name())
+ for dep_key, deps in items_list:
+ for dep in deps:
+ print_dep(dep_key, dep)
else:
print(k + ':')
print(textwrap.indent(pprint.pformat(v), ' '))