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

11 lines
318 B
Python
Raw Permalink Normal View History

2015-06-12 12:17:16 +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]