def test_fail(self):
     # TODO: how to parse git versiosns
     self.assertEquals(
         CraftVersion("Applications/16.12").strictVersion,
         StrictVersion("0.0.0"))
     self.assertEquals(
         CraftVersion("master").strictVersion, StrictVersion("0.0.0"))
 def test_strict(self):
     self.assertEquals(
         CraftVersion("5.8.1").strictVersion, StrictVersion("5.8.1"))
     self.assertEquals(
         CraftVersion("1.0.2j").strictVersion, StrictVersion("1.0.29"))
     self.assertEquals(
         CraftVersion("v1.0.2j").strictVersion, StrictVersion("1.0.29"))
     self.assertEquals(
         CraftVersion("1.0.2.9").strictVersion, StrictVersion("1.0.29"))
示例#3
0
    def __createMeta(self,
                     dstpath: str,
                     name: str,
                     version: str,
                     description: str,
                     webpage: str,
                     deps: str = ""):

        data = {
            "VERSION":
            str(CraftVersion(version).strictVersion),
            "NAME":
            name,
            "DESCRIPTION":
            cgi.escape(f"{name} {version}<br>{description}" +
                       (f"<br>{webpage}" if webpage else "")),
            "DATE":
            datetime.datetime.utcnow().strftime("%Y-%m-%d"),
            "DEPENDENCIES":
            deps
        }
        if not utils.configureFile(
                os.path.join(self.__resources, "package.xml"),
                os.path.join(dstpath, "meta", "package.xml"), data):
            return False

        data = {"SHORTCUTS": self._shortCuts()}
        if not utils.configureFile(
                os.path.join(self.__resources, "installscript.qs"),
                os.path.join(dstpath, "meta", "installscript.qs"), data):
            return False
        return True
示例#4
0
    def _addPackage(self) -> bool:
        if self.__sdkMode:
            imagePrefix = os.path.join(
                CraftCore.settings.get("QtSDK", "Version"),
                CraftCore.settings.get("QtSDK", "Compiler"))
            utils.cleanDirectory(self.archiveDir())
            utils.copyDir(self.imageDir(),
                          os.path.join(self.archiveDir(), imagePrefix))

        dstpath = os.path.join(self.__packageDir, "image",
                               self.qtifyFy(self.package))
        if not self._compress(
                "data.7z",
                self.imageDir() if not self.__sdkMode else self.archiveDir(),
                os.path.join(dstpath, "data"),
                createDigests=False):
            return False

        deps = []
        for x in self.subinfo.runtimeDependencies.keys():
            # TODO:
            # this filter not installed packages but also packages that are virtual on this platform
            package = CraftPackageObject.get(x)
            if isinstance(package.instance, VirtualPackageBase):
                continue
            if os.path.exists(package.instance.imageDir()):
                deps += [self.qtifyFy(package)]

        data = {
            "VERSION":
            str(CraftVersion(self.version).strictVersion),
            "NAME":
            self.package.name,
            "DESCRIPTION":
            cgi.escape(
                f"{self.package.name} {self.version}<br>{self.subinfo.description}"
                +
                (f"<br>{self.subinfo.webpage}" if self.subinfo.webpage else "")
            ),
            "DATE":
            self._date,
            "DEPENDENCIES":
            ", ".join(deps)
        }
        if not utils.configureFile(
                os.path.join(self.__resources, "package.xml"),
                os.path.join(dstpath, "meta", "package.xml"), data):
            return False

        #data = {}
        #if not utils.configureFile(os.path.join(resources, "installscript.qs"), os.path.join(dstpath, "meta", "installscript.qs"), data):
        if not utils.copyFile(
                os.path.join(self.__resources, "installscript.qs"),
                os.path.join(dstpath, "meta", "installscript.qs"),
                linkOnly=False):
            return False
        return True
 def test_compare(self):
     for small, big in [(CraftVersion("5.8.0"), CraftVersion("5.8.1")),
                        (CraftVersion("5.8.0"), CraftVersion("5.8.0-1")),
                        (CraftVersion("1.0.2j"), CraftVersion("1.0.2k")),
                        (CraftVersion("v1.0.2j"), CraftVersion("1.0.2k")),
                        (CraftVersion("5.8.1"), CraftVersion("master")),
                        (CraftVersion("5.8.1"), CraftVersion("dev")),
                        (CraftVersion("Applications/16.12"),
                         CraftVersion("Applications/16.13"))]:
         self.assertEquals(small, small)
         self.assertEquals(big, big)
         self.assertLess(small, big)
         self.assertGreater(big, small)
 def test_str(self):
     self.assertEquals(str(CraftVersion("5.8.1")), "5.8.1")
 def test_compareBranch(self):
     self.assertEquals(CraftVersion("master"), CraftVersion("dev"))
 def test_tag(self):
     for a, b in [(CraftVersion("v1.0.2j"), CraftVersion("1.0.2j"))]:
         self.assertEquals(a.version, b.version)
示例#9
0
 def test_compare(self):
     for small, big in [(CraftVersion("5.8.0"), CraftVersion("5.8.1")),
                        (CraftVersion("5.8.0"), CraftVersion("5.8.0-1")),
                        (CraftVersion("1.0.2j"), CraftVersion("1.0.2k")),
                        (CraftVersion("v1.0.2j"), CraftVersion("1.0.2k")),
                        (CraftVersion("master"), CraftVersion("5.8.1")),
                        (CraftVersion("dev"), CraftVersion("5.8.1")),
                        (CraftVersion("1_59_1"), CraftVersion("1_65_1")),
                        (CraftVersion("1_59"), CraftVersion("1_65_1")),
                        (CraftVersion("master-2017.12.14"),
                         CraftVersion("master-2017.12.15")),
                        (CraftVersion("2017.12-2017.12.14"),
                         CraftVersion("2017.12-2017.12.15")),
                        (CraftVersion("Applications/16.12"),
                         CraftVersion("Applications/16.13"))]:
         if CraftCore.debug.verbose() > 2:
             print(f"{small.version} {big.version}")
         self.assertEquals(small, small)
         self.assertEquals(big, big)
         self.assertLess(small, big)
         self.assertGreater(big, small)