Project/Project.py

changeset 5382
5b772524f302
parent 5359
396145256ada
child 5389
9b1c800daff3
equal deleted inserted replaced
5381:46fc897c5ac0 5382:5b772524f302
4791 4791
4792 ######################################################################### 4792 #########################################################################
4793 ## Below are the plugin development related methods 4793 ## Below are the plugin development related methods
4794 ######################################################################### 4794 #########################################################################
4795 4795
4796 def __pluginVersionToTuple(self, versionStr):
4797 """
4798 Private method to convert a plug-in version string into a version
4799 tuple.
4800
4801 @param versionStr version string to be converted
4802 @type str
4803 @return version info as a tuple
4804 @rtype tuple of int and str
4805 """
4806 vParts = []
4807 if "-" in versionStr:
4808 versionStr, additional = versionStr.split("-", 1)
4809 else:
4810 additional = ""
4811 for part in versionStr.split("."):
4812 try:
4813 vParts.append(int(part))
4814 except ValueError:
4815 vParts.append(part)
4816
4817 if additional:
4818 vParts.append(additional)
4819
4820 return tuple(vParts)
4821
4796 def __pluginCreatePkgList(self): 4822 def __pluginCreatePkgList(self):
4797 """ 4823 """
4798 Private slot to create a PKGLIST file needed for archive file creation. 4824 Private slot to create a PKGLIST file needed for archive file creation.
4799 """ 4825 """
4800 pkglist = os.path.join(self.ppath, "PKGLIST") 4826 pkglist = os.path.join(self.ppath, "PKGLIST")
4917 count += 1 4943 count += 1
4918 continue 4944 continue
4919 4945
4920 lines = names.splitlines() 4946 lines = names.splitlines()
4921 archiveName = "" 4947 archiveName = ""
4948 archiveVersion=""
4922 names = [] 4949 names = []
4923 for line in lines: 4950 for line in lines:
4924 if line.startswith(";"): 4951 if line.startswith(";"):
4952 line = line[1:].strip()
4925 # it's a comment possibly containing a directive 4953 # it's a comment possibly containing a directive
4926 # supported directives are: 4954 # supported directives are:
4927 # - archive_name= defines the name of the archive 4955 # - archive_name= defines the name of the archive
4928 if line[1:].strip().startswith("archive_name="): 4956 # - archive_version= defines the version of the archive
4929 archiveName = line[1:].split("=")[1] 4957 if line.startswith("archive_name="):
4958 archiveName = line.split("=")[1]
4959 elif line.startswith("archive_version="):
4960 archiveVersion = line.split("=")[1]
4930 else: 4961 else:
4931 names.append(line) 4962 names.append(line)
4932 names = sorted(names) 4963 names = sorted(names)
4933 if archiveName: 4964 if archiveName:
4934 archive = os.path.join(self.ppath, archiveName) 4965 archive = os.path.join(self.ppath, archiveName)
4966 name) 4997 name)
4967 if name == self.pdata["MAINSCRIPT"]: 4998 if name == self.pdata["MAINSCRIPT"]:
4968 version = self.__pluginExtractVersion( 4999 version = self.__pluginExtractVersion(
4969 os.path.join(self.ppath, 5000 os.path.join(self.ppath,
4970 self.pdata["MAINSCRIPT"])) 5001 self.pdata["MAINSCRIPT"]))
5002 if archiveVersion and (
5003 self.__pluginVersionToTuple(version) <
5004 self.__pluginVersionToTuple(archiveVersion)
5005 ):
5006 version = archiveVersion
4971 except OSError as why: 5007 except OSError as why:
4972 E5MessageBox.critical( 5008 E5MessageBox.critical(
4973 self.ui, 5009 self.ui,
4974 self.tr("Create Plugin Archive"), 5010 self.tr("Create Plugin Archive"),
4975 self.tr( 5011 self.tr(

eric ide

mercurial