zcutil/make-release.py: Fix to run with Python 3

This commit is contained in:
Jack Grigg 2020-04-15 17:06:07 +12:00
parent b5dda4ecc5
commit 147526b0a8
2 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python2
#! /usr/bin/env python3
import os
import re
@ -9,7 +9,7 @@ import subprocess
import traceback
import unittest
import random
from cStringIO import StringIO
from io import StringIO
from functools import wraps
@ -403,7 +403,7 @@ def initialize_logging():
def sh_out(*args):
logging.debug('Run (out): %r', args)
return subprocess.check_output(args)
return subprocess.check_output(args).decode()
def sh_log(*args):
@ -417,7 +417,7 @@ def sh_log(*args):
logging.debug('Run (log PID %r): %r', p.pid, args)
for line in p.stdout:
logging.debug('> %s', line.rstrip())
logging.debug('> %s', line.decode().rstrip())
status = p.wait()
if status != 0:
raise SystemExit('Nonzero exit status: {!r}'.format(status))
@ -443,6 +443,7 @@ def sh_progress(markers, *args):
pbar.update(marker)
logging.debug('Run (log PID %r): %r', p.pid, args)
for line in p.stdout:
line = line.decode()
logging.debug('> %s', line.rstrip())
for idx, val in enumerate(markers[marker:]):
if val in line:
@ -557,6 +558,12 @@ class Version (object):
self.hotfix,
)
def __lt__(self, other):
return self._sort_tup() < other._sort_tup()
def __eq__(self, other):
return self._sort_tup() == other._sort_tup()
class PathPatcher (object):
def __init__(self, path):

View File

@ -110,7 +110,7 @@ def generate_release_note(version, prev, clear):
latest_tag = subprocess.Popen(['git describe --abbrev=0'], shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
print("Previous release tag: ", latest_tag)
notes = subprocess.Popen(['git shortlog --no-merges {0}..HEAD'.format(latest_tag)], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
lines = notes.split('\n')
lines = notes.decode().split('\n')
lines = [alias_authors_in_release_notes(line) for line in lines]
temp_release_note = os.path.join(doc_dir, 'release-notes.md')
with open(temp_release_note, 'r') as f: