~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugin.py

  • Committer: Marius Kruger
  • Date: 2008-10-16 09:16:48 UTC
  • mto: This revision was merged to the branch mainline in revision 3821.
  • Revision ID: amanic@gmail.com-20081016091648-mv0bz3x9ti4d2rw8
* Can now also handle non-iteratable and string plugin versions.
* Add some more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
452
452
    def version_info(self):
453
453
        """Return the plugin's version_tuple or None if unknown."""
454
454
        version_info = getattr(self.module, 'version_info', None)
455
 
        if version_info is not None and len(version_info) == 3:
456
 
            version_info = tuple(version_info) + ('final', 0)
 
455
        if version_info is not None:
 
456
            try:
 
457
                if isinstance(version_info, types.StringType):
 
458
                    version_info = version_info.split('.')
 
459
                elif len(version_info) == 3:
 
460
                    version_info = tuple(version_info) + ('final', 0)
 
461
            except TypeError, e:
 
462
                # The given version_info isn't even iteratible
 
463
                trace.log_exception_quietly()
 
464
                version_info = (version_info,)
457
465
        return version_info
458
466
 
459
467
    def _get__version__(self):