Skip to content
Snippets Groups Projects
Commit 6113221a authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

branching: merge with stable

I need the fix to `generate-churning-bundle.py`.
parents 03665fd8 d7155949
No related branches found
No related tags found
1 merge request!746generate-churning-bundle: fix script for python3
......@@ -206,5 +206,8 @@
fd.write(data)
if feed_data:
if use_mmap:
fd.flush()
new_data = util.buffer(util.mmapread(fd, new_length))
else:
fd.seek(0)
new_data = fd.read(new_length)
......@@ -209,8 +212,5 @@
fd.seek(0)
new_data = fd.read(new_length)
else:
fd.flush()
new_data = util.buffer(util.mmapread(fd, new_length))
target_docket.data_length = new_length
target_docket.data_unused = new_unused
......
......@@ -46,7 +46,7 @@
def nextcontent(previous_content):
"""utility to produce a new file content from the previous one"""
return hashlib.md5(previous_content).hexdigest()
return hashlib.md5(previous_content).hexdigest().encode('ascii')
def filecontent(iteridx, oldcontent):
......@@ -57,5 +57,5 @@
# initial call
if iteridx is None:
current = ''
current = b''
else:
......@@ -61,5 +61,5 @@
else:
current = str(iteridx)
current = b"%d" % iteridx
for idx in range(NB_LINES):
do_change_line = True
......@@ -67,7 +67,7 @@
do_change_line = not ((idx - iteridx) % OTHER_CHANGES)
if do_change_line:
to_write = current + '\n'
to_write = current + b'\n'
current = nextcontent(current)
else:
to_write = oldcontent[idx]
......@@ -127,7 +127,7 @@
data = bundle.read()
digest = hashlib.md5(data).hexdigest()
with open(target + '.md5', 'wb') as md5file:
md5file.write(digest + '\n')
md5file.write(digest.encode('ascii') + b'\n')
if sys.stdout.isatty():
print('bundle generated at "%s" md5: %s' % (target, digest))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment