Merge pull request #2298 from ijc/fix-docker-version-detection-script

scripts/version.py: Use regex grouping to extract the version
This commit is contained in:
Ulysses Souza 2019-03-28 15:50:44 +01:00 committed by GitHub
commit f97c577c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -62,13 +62,9 @@ def main():
for url in [base_url.format(cat) for cat in categories]:
res = requests.get(url)
content = res.text
versions = [
Version.parse(
v.strip('"').lstrip('docker-').rstrip('.tgz').rstrip('-x86_64')
) for v in re.findall(
r'"docker-[0-9]+\.[0-9]+\.[0-9]+-?.*tgz"', content
)
]
versions = [Version.parse(v) for v in re.findall(
r'"docker-([0-9]+\.[0-9]+\.[0-9]+)-?.*tgz"', content
)]
sorted_versions = sorted(
versions, reverse=True, key=operator.attrgetter('order')
)