mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
1cc8c2c20c
Remove code in revng.cli.model_dump and override_by_name that was used when the model had tags. The code subclassed the default pyYAML loader to ignore unknown tags to allow reading the model data easily. Since the model no longer has tags this code is dead and can be removed.
43 lines
912 B
Python
43 lines
912 B
Python
#
|
|
# This file is distributed under the MIT License. See LICENSE.md for details.
|
|
#
|
|
|
|
import argparse
|
|
import json
|
|
import sys
|
|
|
|
import yaml
|
|
|
|
from . import remap_metaaddress
|
|
|
|
|
|
def log(message):
|
|
sys.stderr.write(message + "\n")
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Extract and process rev.ng model.")
|
|
parser.add_argument(
|
|
"--remap",
|
|
action="store_true",
|
|
help="Remap MetaAddresses. Implies --json.",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if args.remap:
|
|
args.json = True
|
|
|
|
# Consume YAML generated from revng-efa-extractcfg
|
|
input_file = sys.stdin
|
|
|
|
# Decode YAML
|
|
parsed_text = yaml.load(input_file, Loader=yaml.SafeLoader)
|
|
|
|
# Remap MetaAddress
|
|
if args.remap:
|
|
parsed_text = remap_metaaddress(parsed_text)
|
|
|
|
# Dump as JSON
|
|
print(json.dumps(parsed_text, indent=2, sort_keys=True, check_circular=False))
|
|
return 0
|