django-orchestra-test/orchestra/contrib/webapps/utils.py

11 lines
318 B
Python
Raw Normal View History

2023-07-09 07:51:51 +00:00
import re
def extract_version_number(version):
number = re.findall(r'[0-9]+\.?[0-9]?', version)
if not number:
raise ValueError("No version number matches for '%s'" % version)
if len(number) > 1:
raise ValueError("Multiple version number matches for '%s'" % version)
return number[0]