Project/Project.py

changeset 5533
3c908e3b6e5c
parent 5462
52b2f19226e7
child 5555
5ece4e830780
diff -r 3a7c5deab9b7 -r 3c908e3b6e5c Project/Project.py
--- a/Project/Project.py	Sun Feb 19 19:23:21 2017 +0100
+++ b/Project/Project.py	Sun Feb 19 19:57:28 2017 +0100
@@ -4873,6 +4873,14 @@
         if "PKGLIST" in lst:
             lst.remove("PKGLIST")
         
+        # build the header to indicate a freshly generated list
+        header = [
+            ";",
+            "; initial_list (REMOVE THIS LINE WHEN DONE)",
+            ";",
+            " ",
+        ]
+        
         # write the file
         try:
             if self.pdata["EOL"] == 0:
@@ -4880,6 +4888,7 @@
             else:
                 newline = self.getEolString()
             pkglistFile = open(pkglist, "w", encoding="utf-8", newline=newline)
+            pkglistFile.write("\n".join(header) + "\n")
             pkglistFile.write(
                 "\n".join([Utilities.fromNativeSeparators(f) for f in lst]))
             pkglistFile.write("\n")  # ensure the file ends with an empty line
@@ -4967,6 +4976,7 @@
             archiveName = ""
             archiveVersion = ""
             names = []
+            listOK = True
             for line in lines:
                 if line.startswith(";"):
                     line = line[1:].strip()
@@ -4978,8 +4988,25 @@
                         archiveName = line.split("=")[1]
                     elif line.startswith("archive_version="):
                         archiveVersion = line.split("=")[1]
-                else:
-                    names.append(line)
+                    elif line.startswith("initial_list "):
+                        E5MessageBox.critical(
+                            self.ui,
+                            self.tr("Create Plugin Archive"),
+                            self.tr(
+                                """<p>The file <b>{0}</b> is not ready yet."""
+                                """</p><p>Please rework it and delete the"""
+                                """'; initial_list' line of the header."""
+                                """</p>""").format(os.path.basename(pkglist)))
+                        errors += 1
+                        count += 1
+                        listOK = False
+                        break
+                elif line.strip():
+                    names.append(line.strip())
+            
+            if not listOK:
+                continue
+            
             names = sorted(names)
             if archiveName:
                 archive = os.path.join(self.ppath, archiveName)

eric ide

mercurial