Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel).
(version, build='')
| 239 | return lib, version |
| 240 | |
| 241 | def _norm_version(version, build=''): |
| 242 | |
| 243 | """ Normalize the version and build strings and return a single |
| 244 | version string using the format major.minor.build (or patchlevel). |
| 245 | """ |
| 246 | l = version.split('.') |
| 247 | if build: |
| 248 | l.append(build) |
| 249 | try: |
| 250 | strings = list(map(str, map(int, l))) |
| 251 | except ValueError: |
| 252 | strings = l |
| 253 | version = '.'.join(strings[:3]) |
| 254 | return version |
| 255 | |
| 256 | |
| 257 | # Examples of VER command output: |
no test coverage detected