expose name/version from cargodeps

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2017-02-10 21:07:17 +01:00
parent 7551fcba64
commit 5607956af4

View file

@ -6,6 +6,8 @@ from rust2rpm import Metadata
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True) group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-n", "--name", action="store_true", help="Print name")
group.add_argument("-v", "--version", action="store_true", help="Print version")
group.add_argument("-t", "--target-kinds", action="store_true", help="Print target kinds") group.add_argument("-t", "--target-kinds", action="store_true", help="Print target kinds")
group.add_argument("-P", "--provides", action="store_true", help="Print Provides") group.add_argument("-P", "--provides", action="store_true", help="Print Provides")
group.add_argument("-R", "--requires", action="store_true", help="Print Requires") group.add_argument("-R", "--requires", action="store_true", help="Print Requires")
@ -26,6 +28,10 @@ def main():
for f in files: for f in files:
f = f.rstrip() f = f.rstrip()
md = Metadata.from_file(f) md = Metadata.from_file(f)
if args.name:
print(md.name)
if args.version:
print(md.version)
if args.target_kinds: if args.target_kinds:
print("\n".join(set(tgt.kind for tgt in md.targets))) print("\n".join(set(tgt.kind for tgt in md.targets)))
if args.provides: if args.provides: