Skip to content

Commit

Permalink
refactor: script: upgrade build_change_log.py to use py3
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Nov 10, 2020
1 parent e35c6b8 commit aa35d30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 8 additions & 4 deletions scripts/build_change_log.py
Expand Up @@ -2,7 +2,7 @@
# coding: utf-8

import sys
import subprocess32
import subprocess
import semantic_version
import yaml
from collections import defaultdict
Expand Down Expand Up @@ -34,9 +34,10 @@
}

def cmd(cmds):
subproc = subprocess32.Popen(cmds,
stdout=subprocess32.PIPE,
stderr=subprocess32.PIPE, )
subproc = subprocess.Popen(cmds,
encoding='utf-8',
stdout=subprocess.PIPE,
stderr=subprocess.PIPE, )
out, err = subproc.communicate()
subproc.wait()

Expand All @@ -49,6 +50,7 @@ def cmd(cmds):
def list_tags():
out = cmd(["git", "tag", "-l"])
tags = out.splitlines()
tags[0].lstrip('v')
tags = [semantic_version.Version(t.lstrip('v'))
for t in tags
if t != '' ]
Expand Down Expand Up @@ -139,6 +141,8 @@ def build_changelog():
f.write(cont + '\n')

if __name__ == "__main__":
# Usage: to build change log from git log
# ./scripts/build_change_log.py v0.5.10
newver = sys.argv[1]
build_ver_changelog(newver)
build_changelog()
Expand Down
1 change: 0 additions & 1 deletion scripts/requirements.txt
@@ -1,4 +1,3 @@
semantic_version==2.6.0
jinja2==2.10.1
subprocess32==3.2.7
PyYAML==5.3.1

0 comments on commit aa35d30

Please sign in to comment.