1
0
mirror of https://github.com/libuv/libuv synced 2025-03-28 21:13:16 +00:00

tools: migrate tools/make_dist_html.py to python3

PR-URL: https://github.com/libuv/libuv/pull/2915
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Dominique Dumont 2020-07-14 18:33:11 +02:00 committed by Santiago Gimeno
parent dd8662b6d2
commit 4ce3761370
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -1,6 +1,4 @@
#!/usr/bin/python
from __future__ import print_function
#!/usr/bin/python3
import itertools
import os
@ -84,7 +82,7 @@ EXE = r'''
'''
def version(tag):
return map(int, re.match('^v(\d+)\.(\d+)\.(\d+)', tag).groups())
return list(map(int, re.match('^v(\d+)\.(\d+)\.(\d+)', tag).groups()))
def major_minor(tag):
return version(tag)[:2]
@ -114,7 +112,7 @@ def groups_for(groups, n=4):
if __name__ == '__main__':
os.chdir(os.path.dirname(__file__))
tags = subprocess.check_output(['git', 'tag'])
tags = subprocess.check_output(['git', 'tag'], text=True)
tags = [tag for tag in tags.split('\n') if tag.startswith('v')]
tags.sort(key=version, reverse=True)
groups = [group_for(list(g)) for _, g in itertools.groupby(tags, major_minor)]