当前位置: 首页>>代码示例>>Python>>正文


Python version.Version类代码示例

本文整理汇总了Python中version.Version的典型用法代码示例。如果您正苦于以下问题:Python Version类的具体用法?Python Version怎么用?Python Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TwoDashAdd

class TwoDashAdd( unittest.TestCase ):
    def setUp( self ):
        self.base = Version( '3.2.1-devel-test-twodash' )
        
    def testGetMajor( self ):
        assertEquals( 'Major version number' ,
                      self.base.getMajor(),
                      3 )
      
    def testGetMinor( self ):
        assertEquals( 'Minor version number' ,
                      self.base.getMinor(),
                      2 )
                      
    def testGetPatch( self ):
        assertEquals( 'Patch level' ,
                      self.base.getPatch(),
                      1 )
              
    def testGetAddendum( self ):
        assertEquals( 'Addendum' ,
                      self.base.getAddendum(),
                      'devel-test-twodash' )
                      
    def testPrintVersion( self ):
        verString = "%s" % self.base
        assertEquals( 'Version string' ,
                      verString,
                      '3.2.1-devel-test-twodash' )
                      
    def testGetVersionNoAddendum( self ):
        verString = self.base.getVersionNoAddendum()
        assertEquals( 'Version string - no add' ,
                      verString,
                      '3.2.1' )
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:35,代码来源:test_version.py

示例2: MixedVersionNumber

class MixedVersionNumber( unittest.TestCase ):
    def setUp( self ):
        self.base = Version( '2.4.4c1' )
        
    def testGetMajor( self ):
        assertEquals( 'Major version number' ,
                      self.base.getMajor(),
                      2 )
      
    def testGetMinor( self ):
        assertEquals( 'Minor version number' ,
                      self.base.getMinor(),
                      4 )
                      
    def testGetPatch( self ):
        assertEquals( 'Patch level' ,
                      self.base.getPatch(),
                      4 )
              
    def testGetAddendum( self ):
        assertEquals( 'Addendum' ,
                      self.base.getAddendum(),
                      'c1' )
                      
    def testPrintVersion( self ):
        verString = "%s" % self.base
        assertEquals( 'Version string' ,
                      verString,
                      '2.4.4-c1' )
                      
    def testGetVersionNoAddendum( self ):
        verString = self.base.getVersionNoAddendum()
        assertEquals( 'Version string - no add' ,
                      verString,
                      '2.4.4' )
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:35,代码来源:test_version.py

示例3: TwoDigit

class TwoDigit( unittest.TestCase ):
    def setUp( self ):
        self.base = Version( '6.4-foob' )
        
    def testGetMajor( self ):
        assertEquals( 'Major version number' ,
                      self.base.getMajor(),
                      6 )
      
    def testGetMinor( self ):
        assertEquals( 'Minor version number' ,
                      self.base.getMinor(),
                      4 )
                      
    def testGetPatch( self ):
        assertEquals( 'Patch level' ,
                      self.base.getPatch(),
                      0 )
              
    def testGetAddendum( self ):
        assertEquals( 'Addendum' ,
                      self.base.getAddendum(),
                      'foob' )
                      
    def testPrintVersion( self ):
        verString = "%s" % self.base
        assertEquals( 'Version string' ,
                      verString,
                      '6.4-foob' )
                      
    def testGetVersionNoAddendum( self ):
        verString = self.base.getVersionNoAddendum()
        assertEquals( 'Version string - no add' ,
                      verString,
                      '6.4' )
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:35,代码来源:test_version.py

示例4: QueryTestCaseNoAddendum

class QueryTestCaseNoAddendum( unittest.TestCase ):
    def setUp( self ):
        self.base = Version( '3.5.2' )
        
    def testGetMajor( self ):
        assertEquals( 'Major version number' ,
                      self.base.getMajor(),
                      3 )
      
    def testGetMinor( self ):
        assertEquals( 'Minor version number' ,
                      self.base.getMinor(),
                      5 )
                      
    def testGetPatch( self ):
        assertEquals( 'Patch level' ,
                      self.base.getPatch(),
                      2 )
              
    def testGetAddendum( self ):
        assertEquals( 'Addendum' ,
                      self.base.getAddendum(),
                      None )
                      
    def testPrintVersion( self ):
        verString = "%s" % self.base
        assertEquals( 'Version string' ,
                      verString,
                      '3.5.2' )

    def testGetVersionNoAddendum( self ):
        verString = self.base.getVersionNoAddendum()
        assertEquals( 'Version string - no add' ,
                      verString,
                      '3.5.2' )
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:35,代码来源:test_version.py

示例5: do_compatibility_check

def do_compatibility_check(backup_turnkey_version, interactive=True):

    backup_codename = Version.from_string(backup_turnkey_version).codename
    local_codename = Version.from_system().codename

    if local_codename == backup_codename:
        return

    def fmt(s):
        return s.upper().replace("-", " ")

    backup_codename = fmt(backup_codename)
    local_codename = fmt(local_codename)

    print "WARNING: INCOMPATIBLE APPLIANCE BACKUP"
    print "======================================"
    print
    print "Restoring a %s backup to a %s appliance is not recommended." % (backup_codename, local_codename)
    print "For best results, restore to a fresh %s installation instead." % backup_codename

    if not interactive:
        sys.exit(ExitCode.INCOMPATIBLE)

    print
    print "(Use --force to suppress this check)"
    print

    while True:
        answer = raw_input("Do you want to continue? [yes/no] ")
        if answer:
            break

    if answer.lower() not in ('y', 'yes'):
        fatal("You didn't answer 'yes'. Aborting!")
开发者ID:84danielwhite,项目名称:tklbam,代码行数:34,代码来源:cmd_restore.py

示例6: FirstDigitZero

class FirstDigitZero( unittest.TestCase ):
    def setUp( self ):
        self.base = Version( '0.0.1' )
        
    def testGetMajor( self ):
        assertEquals( 'Major version number' ,
                      self.base.getMajor(),
                      0 )
      
    def testGetMinor( self ):
        assertEquals( 'Minor version number' ,
                      self.base.getMinor(),
                      0 )
                      
    def testGetPatch( self ):
        assertEquals( 'Patch level' ,
                      self.base.getPatch(),
                      1 )
              
    def testGetAddendum( self ):
        assertEquals( 'Addendum' ,
                      self.base.getAddendum(),
                      None )
                      
    def testPrintVersion( self ):
        verString = "%s" % self.base
        assertEquals( 'Version string' ,
                      verString,
                      '0.0.1' )
                      
    def testGetVersionNoAddendum( self ):
        verString = self.base.getVersionNoAddendum()
        assertEquals( 'Version string - no add' ,
                      verString,
                      '0.0.1' )
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:35,代码来源:test_version.py

示例7: testFromString

	def testFromString(self):
		v = Version.fromObject("1.3.3sp1")
		self.assertEquals(v.major, 1)
		self.assertEquals(v.minor, '3')
		self.assertEquals(v.micro, '3sp1')
		self.assertEquals(Version.getNumericPiece(v.micro), '3')
		self.assertEquals(Version.getAnnotationPiece(v.micro), 'sp1')
		self.assertEquals(str(v), "1.3.3sp1")
开发者ID:marshall,项目名称:pynaries,代码行数:8,代码来源:tests.py

示例8: update_manifest_hotfix_version

def update_manifest_hotfix_version(file_contents):
    versionPattern = re.compile(r'android:versionName="(\d+).(\d+).(\d+)"')
    result = versionPattern.search(file_contents)
    if result is None or len(result.groups()) != 3:
        raise
    version_raw = list(map(int, result.groups()))
    version = Version(*version_raw)
    current_version = 'android:versionName="{}"'.format(version)
    next_version = 'android:versionName="{}"'.format(version.get_next_hotfix())
    return file_contents.replace(current_version, next_version)
开发者ID:dimagi,项目名称:mobile-deploy,代码行数:10,代码来源:git_utils.py

示例9: archive_old_release_job

def archive_old_release_job(base_job_name, version):
    two_release_ago = Version(version.major, version.minor - 2, 0)
    last_release_job_name = '{}-{}'.format(base_job_name,
                                           two_release_ago.short_string())

    print("moving {} to {} view".format(last_release_job_name,
                                        ARCHIVED_MOBILE_VIEW_NAME))

    remove_job_from_view(last_release_job_name, MOBILE_VIEW_NAME)
    add_job_to_view(last_release_job_name, ARCHIVED_MOBILE_VIEW_NAME)
开发者ID:dimagi,项目名称:mobile-deploy,代码行数:10,代码来源:jenkins_utils.py

示例10: _complete_profile_id

def _complete_profile_id(partial):
    if not re.match(r"^turnkey-", partial):
        partial = "turnkey-" + partial

    partial = Version.from_string(partial)
    system = Version.from_system()

    if partial.arch is None:
        partial.arch = system.arch

    if partial.release is None or system.release.startswith(partial.release):
        partial.release = system.release

    return str(partial)
开发者ID:84danielwhite,项目名称:tklbam,代码行数:14,代码来源:registry.py

示例11: test_change_version_details

    def test_change_version_details(self):
        v = Version('7.1', 'gpconcept-family')

        self.assertEqual('7.1', v.get_number())
        self.assertEqual('gpconcept-family', v.get_name())

        v.set_name('gpcms-family')
        v.set_number('7.10')

        self.assertEqual('7.10', v.get_number())
        self.assertEqual('gpcms-family', v.get_name())
开发者ID:croogie,项目名称:spil-console-tool,代码行数:11,代码来源:versiontest.py

示例12: _update_profile

    def _update_profile(self, profile_id=None):
        """Get a new profile if we don't have a profile in the registry or the Hub
        has a newer profile for this appliance. If we can't contact the Hub raise
        an error if we don't already have profile."""

        hub_backups = hub.Backups(self.sub_apikey)
        if not profile_id:
            if self.profile:
                profile_id = self.profile.profile_id
            else:
                profile_id = str(Version.from_system())

        if self.profile and self.profile.profile_id == profile_id:
            profile_timestamp = self.profile.timestamp
        else:
            # forced profile is not cached in the self
            profile_timestamp = None

        try:
            new_profile = hub_backups.get_new_profile(profile_id, profile_timestamp)
            if new_profile:
                self.profile = new_profile
                print "Downloaded %s profile" % self.profile.profile_id

        except hub_backups.Error, e:
            errno, errname, desc = e.args
            if errname == "BackupArchive.NotFound":
                raise self.ProfileNotFound(desc)

            if not self.profile or (self.profile.profile_id != profile_id):
                raise

            raise self.CachedProfile("using cached profile because of a Hub error: " + desc)
开发者ID:84danielwhite,项目名称:tklbam,代码行数:33,代码来源:registry.py

示例13: __init__

	def __init__(self, version_string, derived=None):
		assert isinstance(version_string, basestring), "Expected string, got %s" % (type(version_string))
		self.upstream = version_string
		if derived is None:
			derived = Version.parse(version_string, coerce=True)
		assert isinstance(derived, Version)
		self.derived = derived
开发者ID:timbertson,项目名称:0downstream,代码行数:7,代码来源:composite_version.py

示例14: __init__

	def __init__(self, id, op=GreaterThan, version="0.0.0"):
		self.id = id
		self.op = op
		self.version = Version.fromObject(version)
		self.resolution = None
		self.resolvedSite = None
		self.error = False
开发者ID:marshall,项目名称:pynaries,代码行数:7,代码来源:bundle.py

示例15: __init__

    def __init__(self, args):
        # Load the database
        home = expanduser("~")
        with open(home + '/.hackertray.json', 'a+') as content_file:
            content_file.seek(0)
            content = content_file.read()
            try:
                self.db = set(json.loads(content))
            except ValueError:
                self.db = set()

        # create an indicator applet
        self.ind = appindicator.Indicator("Hacker Tray", "hacker-tray", appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_icon(get_icon_filename("hacker-tray.png"))

        # create a menu
        self.menu = gtk.Menu()

        # The default state is false, and it toggles when you click on it
        self.commentState = args.comments

        # create items for the menu - refresh, quit and a separator
        menuSeparator = gtk.SeparatorMenuItem()
        menuSeparator.show()
        self.menu.append(menuSeparator)

        btnComments = gtk.CheckMenuItem("Show Comments")
        btnComments.show()
        btnComments.set_active(args.comments)
        btnComments.connect("activate", self.toggleComments)
        self.menu.append(btnComments)

        btnAbout = gtk.MenuItem("About")
        btnAbout.show()
        btnAbout.connect("activate", self.showAbout)
        self.menu.append(btnAbout)

        btnRefresh = gtk.MenuItem("Refresh")
        btnRefresh.show()
        # the last parameter is for not running the timer
        btnRefresh.connect("activate", self.refresh, True, args.chrome)
        self.menu.append(btnRefresh)

        if Version.new_available():
            btnUpdate = gtk.MenuItem("New Update Available")
            btnUpdate.show()
            btnUpdate.connect('activate', self.showUpdate)
            self.menu.append(btnUpdate)

        btnQuit = gtk.MenuItem("Quit")
        btnQuit.show()
        btnQuit.connect("activate", self.quit)
        self.menu.append(btnQuit)

        self.menu.show()

        self.ind.set_menu(self.menu)
        self.refresh(chrome_data_directory=args.chrome, firefox_data_directory=args.firefox)
        self.launch_analytics(args)
开发者ID:artiya4u,项目名称:hackertray,代码行数:60,代码来源:__init__.py


注:本文中的version.Version类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。