##// END OF EJS Templates
generate-churning-bundle: fix script for python3...
marmoute -
r52170:d7155949 stable
parent child Browse files
Show More
@@ -46,7 +46,7 b' OTHER_CHANGES = 300'
46
46
47 def nextcontent(previous_content):
47 def nextcontent(previous_content):
48 """utility to produce a new file content from the previous one"""
48 """utility to produce a new file content from the previous one"""
49 return hashlib.md5(previous_content).hexdigest()
49 return hashlib.md5(previous_content).hexdigest().encode('ascii')
50
50
51
51
52 def filecontent(iteridx, oldcontent):
52 def filecontent(iteridx, oldcontent):
@@ -57,9 +57,9 b' def filecontent(iteridx, oldcontent):'
57
57
58 # initial call
58 # initial call
59 if iteridx is None:
59 if iteridx is None:
60 current = ''
60 current = b''
61 else:
61 else:
62 current = str(iteridx)
62 current = b"%d" % iteridx
63
63
64 for idx in range(NB_LINES):
64 for idx in range(NB_LINES):
65 do_change_line = True
65 do_change_line = True
@@ -67,7 +67,7 b' def filecontent(iteridx, oldcontent):'
67 do_change_line = not ((idx - iteridx) % OTHER_CHANGES)
67 do_change_line = not ((idx - iteridx) % OTHER_CHANGES)
68
68
69 if do_change_line:
69 if do_change_line:
70 to_write = current + '\n'
70 to_write = current + b'\n'
71 current = nextcontent(current)
71 current = nextcontent(current)
72 else:
72 else:
73 to_write = oldcontent[idx]
73 to_write = oldcontent[idx]
@@ -127,7 +127,7 b' def run(target):'
127 data = bundle.read()
127 data = bundle.read()
128 digest = hashlib.md5(data).hexdigest()
128 digest = hashlib.md5(data).hexdigest()
129 with open(target + '.md5', 'wb') as md5file:
129 with open(target + '.md5', 'wb') as md5file:
130 md5file.write(digest + '\n')
130 md5file.write(digest.encode('ascii') + b'\n')
131 if sys.stdout.isatty():
131 if sys.stdout.isatty():
132 print('bundle generated at "%s" md5: %s' % (target, digest))
132 print('bundle generated at "%s" md5: %s' % (target, digest))
133
133
General Comments 0
You need to be logged in to leave comments. Login now