(self, rawtext)
| 43 | |
| 44 | class VersionInfo(object): |
| 45 | def __init__(self, rawtext): |
| 46 | self.rawtext = rawtext |
| 47 | t = self.rawtext.rsplit('-', 2) |
| 48 | if len(t) != 3: |
| 49 | raise MalformedGitTag(self.rawtext) |
| 50 | |
| 51 | vinfo, self.ncommits, self.sha = t |
| 52 | self.ncommits = int(self.ncommits) |
| 53 | |
| 54 | # Split up the X.Y.Z |
| 55 | match = RE_XYZ.match(vinfo) |
| 56 | (self.ver_maj, self.ver_min, self.ver_patch, self.ver_extra) =\ |
| 57 | match.groups() |
| 58 | |
| 59 | # Per PEP-440, replace any 'DP' with an 'a', and any beta with 'b' |
| 60 | if self.ver_extra: |
| 61 | self.ver_extra = re.sub(r'^dp', 'a', self.ver_extra, count=1) |
| 62 | self.ver_extra = re.sub(r'^alpha', 'a', self.ver_extra, count=1) |
| 63 | self.ver_extra = re.sub(r'^beta', 'b', self.ver_extra, count=1) |
| 64 | m = re.search(r'^([ab]|dev|rc|post)(\d+)?', self.ver_extra) |
| 65 | if m.group(1) in ["dev", "post"]: |
| 66 | self.ver_extra = "." + self.ver_extra |
| 67 | if m.group(2) is None: |
| 68 | # No suffix, then add the number |
| 69 | first = self.ver_extra[0] |
| 70 | self.ver_extra = first + '0' + self.ver_extra[1:] |
| 71 | |
| 72 | @property |
| 73 | def is_final(self): |
nothing calls this directly
no test coverage detected