Skip to content

Commit

Permalink
tools: migrate tools/make_dist_html.py to python3
Browse files Browse the repository at this point in the history
PR-URL: libuv#2915
Reviewed-by: Ben Noordhuis <[email protected]>
  • Loading branch information
dod38fr authored and santigimeno committed Dec 28, 2020
1 parent dd8662b commit 4ce3761
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tools/make_dist_html.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/python

from __future__ import print_function
#!/usr/bin/python3

import itertools
import os
Expand Down Expand Up @@ -84,7 +82,7 @@
'''

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]
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit 4ce3761

Please sign in to comment.