Diff of /codesys-ide/scripts/export-documentation.py [000000] .. [33863a]  Maximize  Restore

Switch to side-by-side view

--- a
+++ b/codesys-ide/scripts/export-documentation.py
@@ -0,0 +1,46 @@
+import sys, os, re, shutil
+import helper
+
+def get_artifacts(path, libdir):
+    artifacts = list()
+    # ziph is zipfile handle
+    for root, dirs, files in os.walk(path):
+        if "doc_unzip" in root:
+            for file in files:
+                filename=os.path.join(root, file)
+                dirname=re.split("doc_unzip[^\\\\]*", root)[1].lstrip("\\")
+                print(dirname)
+                destdir=os.path.join(libdir + ".doc", dirname)
+                print("parsing file: %s (%s)" % (filename, destdir))
+                if not os.path.exists(destdir):
+                    os.mkdir(destdir)
+                shutil.copy2(filename, destdir)
+                artifacts.append(os.path.join(destdir, file))
+    return artifacts
+
+
+class SearchBuildDo(helper.SearchBuild):
+    # Build rules for:
+    # - *.library -> *.compiled-library
+    def doit(self, filename):
+        artifacts = list()
+
+        if filename.endswith(".library"):
+            destination = filename.replace(".library", ".compiled-library")
+            artifacts.append(destination)
+
+            print("%s -> %s\n" % (filename, destination))
+
+            proj = projects.open(filename)
+            proj.save_as_compiled_library(destination)
+            print(os.environ)
+            artifacts = get_artifacts(os.path.join("c:", "users", "Public", "Application Data", "CODESYS", "Temporary Files"), filename)
+            proj.close()
+
+        return artifacts
+
+scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
+
+sb = SearchBuildDo()
+sb.search(".library", ".")
+sb.save(".", ".drone-artifacts")