]> git.proxmox.com Git - cargo.git/commitdiff
guesst-crate-copyright: handle missing authors
authorFabian Grünbichler <debian@fabian.gruenbichler.email>
Sat, 15 Oct 2022 12:09:25 +0000 (14:09 +0200)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Sat, 15 Oct 2022 12:09:25 +0000 (14:09 +0200)
Signed-off-by: Fabian Grünbichler <debian@fabian.gruenbichler.email>
debian/scripts/guess-crate-copyright

index 13e34d9699a9a6e5b353b93bbaca1f9641b6a54a..745eaf8d83ff50935b1500e4a1dacd2fd3c4f6df 100755 (executable)
@@ -30,13 +30,16 @@ rm -rf tmp.crate-copyright""" % repo, shell=True).decode("utf-8")
                else:
                        first_year = "20XX"
                        last_year = this_year
+
+               authors = data["package"].get("authors", ["UNKNOWN AUTHORS"])
+
                print("""Files: {0}
 Copyright: {1}
 License: {2}
 Comment: see {3}
 """.format(
                os.path.join(crate, "*"),
-               "\n           ".join("%s-%s %s" % (first_year, last_year, a.replace(" <>", "")) for a in data ["package"]["authors"]),
+               "\n           ".join("%s-%s %s" % (first_year, last_year, a.replace(" <>", "")) for a in authors),
                data["package"].get("license", "???").replace("/", " or "),
                repo or "???"
        ))