Show More
@@ -46,7 +46,7 b' OTHER_CHANGES = 300' | |||
|
46 | 46 | |
|
47 | 47 | def nextcontent(previous_content): |
|
48 | 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 | 52 | def filecontent(iteridx, oldcontent): |
@@ -57,9 +57,9 b' def filecontent(iteridx, oldcontent):' | |||
|
57 | 57 | |
|
58 | 58 | # initial call |
|
59 | 59 | if iteridx is None: |
|
60 | current = '' | |
|
60 | current = b'' | |
|
61 | 61 | else: |
|
62 |
current = |
|
|
62 | current = b"%d" % iteridx | |
|
63 | 63 | |
|
64 | 64 | for idx in range(NB_LINES): |
|
65 | 65 | do_change_line = True |
@@ -67,7 +67,7 b' def filecontent(iteridx, oldcontent):' | |||
|
67 | 67 | do_change_line = not ((idx - iteridx) % OTHER_CHANGES) |
|
68 | 68 | |
|
69 | 69 | if do_change_line: |
|
70 | to_write = current + '\n' | |
|
70 | to_write = current + b'\n' | |
|
71 | 71 | current = nextcontent(current) |
|
72 | 72 | else: |
|
73 | 73 | to_write = oldcontent[idx] |
@@ -127,7 +127,7 b' def run(target):' | |||
|
127 | 127 | data = bundle.read() |
|
128 | 128 | digest = hashlib.md5(data).hexdigest() |
|
129 | 129 | with open(target + '.md5', 'wb') as md5file: |
|
130 | md5file.write(digest + '\n') | |
|
130 | md5file.write(digest.encode('ascii') + b'\n') | |
|
131 | 131 | if sys.stdout.isatty(): |
|
132 | 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