4871 lst.append(entry) |
4871 lst.append(entry) |
4872 lst.sort() |
4872 lst.sort() |
4873 if "PKGLIST" in lst: |
4873 if "PKGLIST" in lst: |
4874 lst.remove("PKGLIST") |
4874 lst.remove("PKGLIST") |
4875 |
4875 |
|
4876 # build the header to indicate a freshly generated list |
|
4877 header = [ |
|
4878 ";", |
|
4879 "; initial_list (REMOVE THIS LINE WHEN DONE)", |
|
4880 ";", |
|
4881 " ", |
|
4882 ] |
|
4883 |
4876 # write the file |
4884 # write the file |
4877 try: |
4885 try: |
4878 if self.pdata["EOL"] == 0: |
4886 if self.pdata["EOL"] == 0: |
4879 newline = None |
4887 newline = None |
4880 else: |
4888 else: |
4881 newline = self.getEolString() |
4889 newline = self.getEolString() |
4882 pkglistFile = open(pkglist, "w", encoding="utf-8", newline=newline) |
4890 pkglistFile = open(pkglist, "w", encoding="utf-8", newline=newline) |
|
4891 pkglistFile.write("\n".join(header) + "\n") |
4883 pkglistFile.write( |
4892 pkglistFile.write( |
4884 "\n".join([Utilities.fromNativeSeparators(f) for f in lst])) |
4893 "\n".join([Utilities.fromNativeSeparators(f) for f in lst])) |
4885 pkglistFile.write("\n") # ensure the file ends with an empty line |
4894 pkglistFile.write("\n") # ensure the file ends with an empty line |
4886 pkglistFile.close() |
4895 pkglistFile.close() |
4887 except IOError as why: |
4896 except IOError as why: |
4976 # - archive_version= defines the version of the archive |
4986 # - archive_version= defines the version of the archive |
4977 if line.startswith("archive_name="): |
4987 if line.startswith("archive_name="): |
4978 archiveName = line.split("=")[1] |
4988 archiveName = line.split("=")[1] |
4979 elif line.startswith("archive_version="): |
4989 elif line.startswith("archive_version="): |
4980 archiveVersion = line.split("=")[1] |
4990 archiveVersion = line.split("=")[1] |
4981 else: |
4991 elif line.startswith("initial_list "): |
4982 names.append(line) |
4992 E5MessageBox.critical( |
|
4993 self.ui, |
|
4994 self.tr("Create Plugin Archive"), |
|
4995 self.tr( |
|
4996 """<p>The file <b>{0}</b> is not ready yet.""" |
|
4997 """</p><p>Please rework it and delete the""" |
|
4998 """'; initial_list' line of the header.""" |
|
4999 """</p>""").format(os.path.basename(pkglist))) |
|
5000 errors += 1 |
|
5001 count += 1 |
|
5002 listOK = False |
|
5003 break |
|
5004 elif line.strip(): |
|
5005 names.append(line.strip()) |
|
5006 |
|
5007 if not listOK: |
|
5008 continue |
|
5009 |
4983 names = sorted(names) |
5010 names = sorted(names) |
4984 if archiveName: |
5011 if archiveName: |
4985 archive = os.path.join(self.ppath, archiveName) |
5012 archive = os.path.join(self.ppath, archiveName) |
4986 else: |
5013 else: |
4987 archive = os.path.join( |
5014 archive = os.path.join( |