4 """This script reads metadata from a given file"""
6 from __future__
import print_function
12 from PyUtils.MetaDiff
import meta_diff
16 if "TERM" in os.environ:
17 del os.environ[
"TERM"]
21 """Handle command line arguments and call meta_diff"""
23 parser = argparse.ArgumentParser(
24 description=
"Compare the metadata content of two files"
31 help=
"The names of two files to compare",
38 help=
"print detailed output on screen",
45 help=
"When comparing lists, check the element order too.",
52 help=
"Allows filtering by regex instead of by plain string",
59 help=
"Show only the keys and not the difference",
68 help=
"Keys to drop from metadata retrieved from file. Separe nested dictionary keys using '.'. An '*' matches any key.",
77 choices=[
"tiny",
"lite",
"full",
"peeker"],
79 This flag provides the user capability to select the amount of
80 metadata retrieved. There are four options:
81 tiny (only those values used in PyJobTransforms),
84 and full ( all available data found)
94 choices=[
"POOL",
"BS"],
96 The file type of the input filename. By default, it tries to
97 determine itself the file type of the input.
108 help=
"Expression to select specific metadata fields to retrieve.",
116 choices=[
"simple",
"diff"],
117 help=
"Switch between 'simple' or 'diff' style differences ",
124 help=
"Force promotion or not of the metadata keys ",
130 help=
"Ignore trigger metadata",
133 args = parser.parse_args()
135 if len(args.files) != 2:
136 print(
"you must supply two files to compare")
139 for file_name
in args.files:
140 if not os.path.exists(file_name):
141 print(
"File does not exists: {}".
format(file_name))
147 verbose=args.verbose,
148 ordered=args.ordered,
151 meta_key_filter=args.filter,
153 promote=args.promote,
154 diff_format=args.diff_format,
156 key_only=args.key_only,
157 ignore_trigger=args.ignoreTrigger,
168 if __name__ ==
"__main__":