print provides for each feature

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2017-01-30 18:37:29 +01:00
parent 62bb483451
commit eea2ef7496

View file

@ -69,14 +69,17 @@ args = parser.parse_args()
files = args.file or sys.stdin.readlines() files = args.file or sys.stdin.readlines()
def print_dep(name, spec, kind="="): def print_dep(name, spec, kind="=", feature=None):
print("crate({}) {} {}".format(name, kind.replace("==", "="), spec)) f_part = "({})".format(feature) if feature is not None else ""
print("crate({}){} {} {}".format(name, f_part, kind.replace("==", "="), spec))
for f in files: for f in files:
f = f.rstrip() f = f.rstrip()
md = get_metadata(f) md = get_metadata(f)
if args.provides: if args.provides:
print_dep(md["name"], md["version"]) print_dep(md["name"], md["version"])
for feature in md["features"]:
print_dep(md["name"], md["version"], feature=feature)
if args.requires or args.conflicts: if args.requires or args.conflicts:
for dep in md["dependencies"]: for dep in md["dependencies"]:
if dep["kind"] is not None: if dep["kind"] is not None: