Exemple #1
0
 def testParse3(self):
     self.assertTrue(Version.parse("1.2.3 beta") ==
                     Version(1, 2, 3, status=StatusSet.BETA))
     self.assertTrue(Version.parse(" 1.2.3 dev") ==
                     Version(1, 2, 3, status=StatusSet.DEV))
     self.assertTrue(Version.parse("1.2.3  release ") ==
                     Version(1, 2, 3, status=StatusSet.RELEASE))
     self.assertTrue(Version.parse("1.2.3") ==
                     Version(1, 2, 3, status=StatusSet.RELEASE))
Exemple #2
0
 def testParse3(self):
     self.assertTrue(Version.parse("1.2.3 beta") ==
                     Version(1, 2, 3, status=StatusSet.BETA))
     self.assertTrue(Version.parse(" 1.2.3 dev") ==
                     Version(1, 2, 3, status=StatusSet.DEV))
     self.assertTrue(Version.parse("1.2.3  release ") ==
                     Version(1, 2, 3, status=StatusSet.RELEASE))
     self.assertTrue(Version.parse("1.2.3") ==
                     Version(1, 2, 3, status=StatusSet.RELEASE))
Exemple #3
0
 def testParse3(self):
     self.assertTrue(
         Version.parse("1.2.3 beta") == Version(
             1, 2, 3, status=StatusSet.BETA))
     self.assertTrue(
         Version.parse(" 1.2.3 dev") == Version(
             1, 2, 3, status=StatusSet.DEV))
     self.assertTrue(
         Version.parse("1.2.3  stable ") == Version(
             1, 2, 3, status=StatusSet.STABLE))
Exemple #4
0
    def filterUpdatedApps(currentVersionsDict, latestAppInfoDict):
        """
        Return dictionary with the AppInfo for updated apps only.

        currentVersionsDict - dictionary with apps versions.
            Key - plugin name or special id,
            value - version number string.

        latestAppInfoDict - dictionary with AppInfo instances.
            Key - plugin name or special id,
            value - instance of the AppInfo.
        """
        updatedPlugins = {}

        for app_name, version_str in currentVersionsDict.items():
            if app_name not in latestAppInfoDict:
                continue

            latestAppInfo = latestAppInfoDict[app_name]

            try:
                currentPluginVersion = Version.parse(version_str)
            except ValueError:
                continue

            latestVersion = latestAppInfo.currentVersion
            if (latestVersion is not None and
                    latestVersion > currentPluginVersion):
                updatedPlugins[app_name] = latestAppInfo

        return updatedPlugins
    def filterUpdatedApps(currentVersionsDict, latestAppInfoDict):
        """
        Return dictionary with the AppInfo for updated apps only.

        currentVersionsDict - dictionary with apps versions.
            Key - plugin name or special id,
            value - version number string.

        latestAppInfoDict - dictionary with AppInfo instances.
            Key - plugin name or special id,
            value - instance of the AppInfo.
        """
        updatedPlugins = {}

        for app_name, version_str in currentVersionsDict.items():
            if app_name not in latestAppInfoDict:
                continue

            latestAppInfo = latestAppInfoDict[app_name]

            try:
                currentPluginVersion = Version.parse(version_str)
            except ValueError:
                continue

            latestVersion = latestAppInfo.currentVersion
            if (latestVersion is not None and
                    latestVersion > currentPluginVersion):
                updatedPlugins[app_name] = latestAppInfo

        return updatedPlugins
Exemple #6
0
    def test_changelog_single_03(self):
        version_1 = VersionInfo(Version.parse(u'1.2.3 beta'))
        changelog = [version_1]
        appinfo = AppInfo(self._appname, self._author, changelog)
        generator = SiteChangelogGenerator(appinfo)
        changelog = generator.make()

        right_result = u'''!!!! 1.2.3 beta'''
        self.assertEqual(changelog, right_result)
Exemple #7
0
    def test_changelog_single_03(self):
        version_1 = VersionInfo(Version.parse(u'1.2.3 beta'))
        changelog = [version_1]
        appinfo = AppInfo(self._appname, self._author, changelog)
        generator = SiteChangelogGenerator(appinfo)
        changelog = generator.make()

        right_result = u'''!!!! 1.2.3 beta'''
        self.assertEqual(changelog, right_result)
Exemple #8
0
    def _getVersionFromPage(self, url, versionname, status=""):
        """
        url - ссылка, откуда получается номер версии
        versionname - название версии (stable, unstable и т.п.)
        """
        if url is None:
            return None

        text = self._loadPage(url)
        versions = extractVersion(text)

        if versionname not in versions:
            return None

        return Version.parse(versions[versionname] + " " + status)
Exemple #9
0
    def _getVersionFromPage (self, url, versionname, status=""):
        """
        url - ссылка, откуда получается номер версии
        versionname - название версии (stable, unstable и т.п.)
        """
        if url == None:
            return None

        text = self._loadPage (url)
        versions = extractVersion (text)

        if versionname not in versions:
            return None

        return Version.parse (versions[versionname] + " " + status)
Exemple #10
0
def getCurrentVersion ():
    fname = "version.txt"
    path = os.path.join (outwiker.core.system.getCurrentDir(), fname)

    try:
        with open (path) as fp:
            lines = fp.readlines()
    except IOError:
        MessageBox (_(u"Can't open file %s") % fname, _(u"Error"), wx.ICON_ERROR | wx.OK)
        return

    version_str = "%s.%s %s" % (lines[0].strip(),
                                lines[1].strip(),
                                lines[2].strip())

    try:
        version = Version.parse (version_str)
    except ValueError:
        MessageBox (_(u"Can't parse version"),
                    _(u"Error"),
                    wx.ICON_ERROR | wx.OK)
        version = Version(0, 0)

    return version
Exemple #11
0
def getCurrentVersion():
    fname = "version.txt"
    path = os.path.join(outwiker.core.system.getCurrentDir(), fname)

    try:
        with open(path) as fp:
            lines = fp.readlines()
    except IOError:
        MessageBox(
            _(u"Can't open file %s") % fname, _(u"Error"),
            wx.ICON_ERROR | wx.OK)
        return

    version_str = "%s.%s %s" % (lines[0].strip(), lines[1].strip(),
                                lines[2].strip())

    try:
        version = Version.parse(version_str)
    except ValueError:
        MessageBox(_(u"Can't parse version"), _(u"Error"),
                   wx.ICON_ERROR | wx.OK)
        version = Version(0, 0)

    return version
Exemple #12
0
    def getUpdatedPlugins(self, verList):
        """
        Возвращает список плагинов, которые обновились
        """
        updatedPlugins = []

        for plugin in self._application.plugins:
            pluginVersion = verList.getPluginVersion(plugin.name)

            try:
                currentPluginVersion = Version.parse(plugin.version)
            except ValueError:
                continue

            try:
                verList.getPluginUrl(plugin.name)
            except KeyError:
                continue

            if (pluginVersion is not None
                    and pluginVersion > currentPluginVersion):
                updatedPlugins.append(plugin)

        return updatedPlugins
Exemple #13
0
    def getUpdatedPlugins (self, verList):
        """
        Возвращает список плагинов, которые обновились
        """
        updatedPlugins = []

        for plugin in self._application.plugins:
            pluginVersion = verList.getPluginVersion (plugin.name)

            try:
                currentPluginVersion = Version.parse (plugin.version)
            except ValueError:
                continue

            try:
                pluginUrl = verList.getPluginUrl (plugin.name)
            except KeyError:
                continue

            if (pluginVersion != None and
                    pluginVersion > currentPluginVersion):
                updatedPlugins.append (plugin)

        return updatedPlugins
Exemple #14
0
 def testParse1(self):
     self.assertTrue(Version.parse("1") == Version(1))
Exemple #15
0
    fname = "version.txt"
    path = os.path.join (outwiker.core.system.getCurrentDir(), fname)

    try:
        with open (path) as fp:
            lines = fp.readlines()
    except IOError, e:
        MessageBox (_(u"Can't open file %s") % fname, _(u"Error"), wx.ICON_ERROR | wx.OK)
        return

    version_str = "%s.%s %s" % (lines[0].strip(), 
            lines[1].strip(), 
            lines[2].strip())

    try:
        version = Version.parse (version_str)
    except ValueError:
        MessageBox (_(u"Can't parse version"), 
                _(u"Error"), 
                wx.ICON_ERROR | wx.OK)
        version = Version(0, 0)

    return version


@testreadonly
def renamePage (page, newtitle):
    if not testPageTitle (newtitle):
        return

    try:
Exemple #16
0
 def testParse3 (self):
     self.assertTrue (Version.parse ("1.2.3 beta") == Version (1, 2, 3, status=StatusSet.BETA))
     self.assertTrue (Version.parse (" 1.2.3 dev") == Version (1, 2, 3, status=StatusSet.DEV))
     self.assertTrue (Version.parse ("1.2.3  stable ") == Version (1, 2, 3, status=StatusSet.STABLE))
Exemple #17
0
 def testParse2(self):
     self.assertTrue(
         Version.parse("1.2.3") == Version(1, 2, 3),
         str(Version.parse("1.2.3")))
Exemple #18
0
 def testParse1(self):
     self.assertTrue(Version.parse("1") == Version(1))
Exemple #19
0
 def testParse2(self):
     self.assertTrue(Version.parse("1.2.3") == Version(1, 2, 3),
                     str(Version.parse("1.2.3")))