Changed code to ensure, that the PKGLIST file is created with an empty last line (i.e. ends with '\n'). 5_3_x

Sun, 24 Mar 2013 13:21:43 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 24 Mar 2013 13:21:43 +0100
branch
5_3_x
changeset 2522
250b92d6f3f9
parent 2520
d226e801d308
child 2524
34ab99b2fbff

Changed code to ensure, that the PKGLIST file is created with an empty last line (i.e. ends with '\n').
(grafted from ca91f5ee1b23ef43b092ad12ce92a3a005acbb9b)

Project/Project.py file | annotate | diff | comparison | revisions
--- a/Project/Project.py	Sun Mar 24 13:08:24 2013 +0100
+++ b/Project/Project.py	Sun Mar 24 13:21:43 2013 +0100
@@ -4249,6 +4249,7 @@
                 newline = self.getEolString()
             pkglistFile = open(pkglist, "w", encoding="utf-8", newline=newline)
             pkglistFile.write("\n".join(lst))
+            pkglistFile.write("\n") # ensure the file ends with an empty line
             pkglistFile.close()
         except IOError as why:
             E5MessageBox.critical(self.ui,
@@ -4307,24 +4308,25 @@
             return
         
         for name in names:
-            try:
-                self.__createZipDirEntries(os.path.split(name)[0], archiveFile)
-                if snapshot and name == self.pdata["MAINSCRIPT"][0]:
-                    snapshotSource, version = self.__createSnapshotSource(
-                        os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0]))
-                    archiveFile.writestr(name, snapshotSource)
-                else:
-                    archiveFile.write(os.path.join(self.ppath, name), name)
-                    if name == self.pdata["MAINSCRIPT"][0]:
-                        version = self.__pluginExtractVersion(
+            if name:
+                try:
+                    self.__createZipDirEntries(os.path.split(name)[0], archiveFile)
+                    if snapshot and name == self.pdata["MAINSCRIPT"][0]:
+                        snapshotSource, version = self.__createSnapshotSource(
                             os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0]))
-            except OSError as why:
-                E5MessageBox.critical(self.ui,
-                    self.trUtf8("Create Plugin Archive"),
-                    self.trUtf8("""<p>The file <b>{0}</b> could not be stored """
-                                """in the archive. Ignoring it.</p>"""
-                                """<p>Reason: {1}</p>""")\
-                                .format(os.path.join(self.ppath, name), str(why)))
+                        archiveFile.writestr(name, snapshotSource)
+                    else:
+                        archiveFile.write(os.path.join(self.ppath, name), name)
+                        if name == self.pdata["MAINSCRIPT"][0]:
+                            version = self.__pluginExtractVersion(
+                                os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0]))
+                except OSError as why:
+                    E5MessageBox.critical(self.ui,
+                        self.trUtf8("Create Plugin Archive"),
+                        self.trUtf8("""<p>The file <b>{0}</b> could not be stored """
+                                    """in the archive. Ignoring it.</p>"""
+                                    """<p>Reason: {1}</p>""")\
+                                    .format(os.path.join(self.ppath, name), str(why)))
         archiveFile.writestr("VERSION", version.encode("utf-8"))
         archiveFile.close()
         

eric ide

mercurial