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))
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))
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))
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
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)
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)
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)
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)
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
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
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
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
def testParse1(self): self.assertTrue(Version.parse("1") == Version(1))
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:
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))
def testParse2(self): self.assertTrue( Version.parse("1.2.3") == Version(1, 2, 3), str(Version.parse("1.2.3")))
def testParse1(self): self.assertTrue(Version.parse("1") == Version(1))
def testParse2(self): self.assertTrue(Version.parse("1.2.3") == Version(1, 2, 3), str(Version.parse("1.2.3")))