[sysadmin-bin] Don't fail in case of proglang/category DOAP fields missing (https://gitlab.gnome.org/Infrastructure



commit 5359ef48e0644357fd3e7ae73328831cba6762f7
Author: Andrea Veri <averi redhat com>
Date:   Tue Nov 3 13:29:46 2020 +0100

    Don't fail in case of proglang/category DOAP fields missing 
(https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/476)

 git/extract-doap-info | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/git/extract-doap-info b/git/extract-doap-info
index 2a558f5..e06876c 100755
--- a/git/extract-doap-info
+++ b/git/extract-doap-info
@@ -38,15 +38,22 @@ with open(os.path.join(git_dir, "gnome_doap"), "w") as f:
     f.write(rdf)
 
 # And then pre-parse out a couple of particular properties
-category_attr = prj.find(f"{{{DOAP}}}category").attrib
-category = category_attr.get(f"{{{RDF}}}resource").split("#")[1]
-with open(os.path.join(git_dir, "gnome_group"), "w") as f:
-    f.write(f"{category}\n")
+try:
+    category_attr = prj.find(f"{{{DOAP}}}category").attrib
+    category = category_attr.get(f"{{{RDF}}}resource").split("#")[1]
+
+    with open(os.path.join(git_dir, "gnome_group"), "w") as f:
+        f.write(f"{category}\n")
+except AttributeError:
+    pass
 
 shortdesc = prj.find(f"{{{DOAP}}}shortdesc").text
 with open(os.path.join(git_dir, "description"), "w") as f:
     f.write(f"{shortdesc}\n")
 
-proglang = prj.find(f"{{{DOAP}}}programming-language").text
-with open(os.path.join(git_dir, "programming-language"), "w") as f:
-    f.write(f"{proglang}\n")
+try:
+    proglang = prj.find(f"{{{DOAP}}}programming-language").text
+    with open(os.path.join(git_dir, "programming-language"), "w") as f:
+        f.write(f"{proglang}\n")
+except AttributeError:
+    pass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]