Fix versions.py to include release stage

Signed-off-by: Joffrey F <f.joffrey@gmail.com>
This commit is contained in:
Joffrey F 2019-04-30 23:16:09 -07:00
parent 613d6aad83
commit 20a5c06724
1 changed files with 3 additions and 3 deletions

6
scripts/versions.py Normal file → Executable file
View File

@ -26,8 +26,8 @@ class Version(namedtuple('_Version', 'major minor patch stage edition')):
edition = stage
stage = None
elif '-' in stage:
edition, stage = stage.split('-')
major, minor, patch = version.split('.', 3)
edition, stage = stage.split('-', 1)
major, minor, patch = version.split('.', 2)
return cls(major, minor, patch, stage, edition)
@property
@ -63,7 +63,7 @@ def main():
res = requests.get(url)
content = res.text
versions = [Version.parse(v) for v in re.findall(
r'"docker-([0-9]+\.[0-9]+\.[0-9]+)-?.*tgz"', content
r'"docker-([0-9]+\.[0-9]+\.[0-9]+-?.*)\.tgz"', content
)]
sorted_versions = sorted(
versions, reverse=True, key=operator.attrgetter('order')