| 1 |
from packaging.version import parse as parse_version |
| 2 |
|
| 3 |
|
| 4 |
def parse_tag_version(tag): |
| 5 |
""" |
| 6 |
Parse the version portion of the tag into a comparable |
| 7 |
version object. |
| 8 |
|
| 9 |
Parameters |
| 10 |
---------- |
| 11 |
tag : str |
| 12 |
|
| 13 |
Returns |
| 14 |
------- |
| 15 |
packaging.version.Version |
| 16 |
""" |
| 17 |
return parse_version(tag[tag.rfind("-") + 1 :]) |
| 18 |
|
| 19 |
|
| 20 |
def get_tag_name(tag): |
| 21 |
""" |
| 22 |
Extract the name portion of a tag URI. |
| 23 |
|
| 24 |
Parameters |
| 25 |
---------- |
| 26 |
tag : str |
| 27 |
|
| 28 |
Returns |
| 29 |
------- |
| 30 |
str |
| 31 |
""" |
| 32 |
return tag[tag.rfind("/") + 1 : tag.rfind("-")] |