From 5cb383e6e87bb5860dcfd9a3d2b4726e8202dd42 Mon Sep 17 00:00:00 2001
From: Felix Gerking <felix.gerking@garz-fricke.com>
Date: Wed, 30 Mar 2022 17:39:03 +0200
Subject: [PATCH] alphaplan_fwr:manifest-CI: Cleanup

Remove alphaplan_fwr debug code and run black and pylint.
---
 alphaplan_fwr.py   | 12 ++++--------
 manifest-build.yml |  4 +---
 package_release.py | 12 +++++++++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/alphaplan_fwr.py b/alphaplan_fwr.py
index 16ba3f8b..150dfa28 100755
--- a/alphaplan_fwr.py
+++ b/alphaplan_fwr.py
@@ -10,8 +10,6 @@ from alphaplan_keys import ApKeys, ApSubKeys, get_ap_dict
 
 
 def ap_send_json(jsonobj):
-    print("##### Currently in debug mode: No data is send to AlphaPlan webservice")
-    return
     """Sends the generated files to the Alphaplan webservice"""
     url = os.environ.get("AP_WEBSERVICE_URL")
     usr = os.environ.get("AP_WEBSERVICE_USR")
@@ -289,9 +287,7 @@ def main():
     args, _ = parser.parse_known_args()
 
     if args.outputdir_upload is None or args.outputdir_local is None:
-        sys.exit(
-            "ERROR: outputdir-local and outputdir-upload needs to be specified."
-        )
+        sys.exit("ERROR: outputdir-local and outputdir-upload needs to be specified.")
 
     # Get bitbake variables from testdata.json file
     testdata_files = []
@@ -323,12 +319,12 @@ def main():
     # Get md5sums.txt
     md5sums_file = os.path.join(output_dir, machine, "md5sums.txt")
     md5sums = {}
-    with open(md5sums_file) as f:
+    with open(md5sums_file, encoding="utf-8") as f:
         for line in f:
             # Assuming line format: "<md5sum>  <filename>\n"
             name = line.split("  ")[1].rstrip()
-            sum = line.split("  ")[0]
-            md5sums[name] = sum
+            md5sum = line.split("  ")[0]
+            md5sums[name] = md5sum
 
     # Generate alphaplan FWR articles
     generate_fwr_articles(
diff --git a/manifest-build.yml b/manifest-build.yml
index b0987e7c..7ee45351 100644
--- a/manifest-build.yml
+++ b/manifest-build.yml
@@ -153,9 +153,7 @@ variables:
       # Generate AlphaPlan FWR articles if release tag is set
       apscript=".gitlab-ci/alphaplan_fwr.py"
 
-      #if [ -n "$CI_COMMIT_TAG" ] && \
-      echo "CI AP debug mode"
-      if true && \
+      if [ -n "$CI_COMMIT_TAG" ] && \
         [ -d "${ARTIFACTS_IMAGE_PATH}" ] && \
         [[ "${CI_PARAM_PACKAGE_FTP}" == "false" ]];then
         # Check if alphaplan fwr script is available
diff --git a/package_release.py b/package_release.py
index 8d75985d..6b3b4eec 100755
--- a/package_release.py
+++ b/package_release.py
@@ -173,7 +173,9 @@ def main():
             convertmd2html(f, fout)
             html_files.append(fout)
 
-        doc_md5sums = copy_files(doc_files + html_files, "", "", output_dir, outlocal_dir)
+        doc_md5sums = copy_files(
+            doc_files + html_files, "", "", output_dir, outlocal_dir
+        )
         write_md5sums_file(doc_md5sums, "", output_dir, outlocal_dir)
 
     if args.images_dir is not None:
@@ -224,8 +226,12 @@ def main():
     # Handle SDK if available
     if args.sdk_dir is not None:
         sdkfiles = glob.glob(os.path.join(args.sdk_dir, sdkname + "*"))
-        sdk_md5sums = copy_files(sdkfiles, "", os.path.join(machine, "sdk"), None, outlocal_dir)
-        write_md5sums_file(sdk_md5sums, os.path.join(machine, "sdk"), None, outlocal_dir)
+        sdk_md5sums = copy_files(
+            sdkfiles, "", os.path.join(machine, "sdk"), None, outlocal_dir
+        )
+        write_md5sums_file(
+            sdk_md5sums, os.path.join(machine, "sdk"), None, outlocal_dir
+        )
 
     # Store pathes and other stuff in environment variable file
     with open("package.env", "w", encoding="utf-8") as env_file:
-- 
GitLab