]> TLD Linux GIT Repositories - tld-builder.git/blobdiff - TLD_Builder/chroot.py
- more python3 fixes, dropped python2 support
[tld-builder.git] / TLD_Builder / chroot.py
index f91e1c60369c6d0511f9391753430ba5e597d877..8acd58d10abd628384e8b39960ec30cca3dcf031 100644 (file)
@@ -3,6 +3,7 @@
 import os
 import re
 import random
+import util
 
 try:
     from hashlib import md5 as md5
@@ -49,7 +50,7 @@ def run(cmd, user = "builder", logfile = None, logstdout = None):
 
 def cp(file, outfile, user="builder", rm=False):
     m = md5()
-    m.update(str(random.sample(range(100000), 500)).encode('utf-8'))
+    m.update(util.to_bytes(str(random.sample(range(100000), 500))))
     digest = m.hexdigest()
 
     marker_start = "--- FILE BEGIN DIGEST %s ---" % digest
@@ -70,11 +71,11 @@ def cp(file, outfile, user="builder", rm=False):
         me = l.find(marker_end)
         if me != -1:
             l = l[:me]
-            f.write(l)
+            f.write(util.to_bytes(l))
             marker = False
             break
         if marker:
-            f.write(l)
+            f.write(util.to_bytes(l))
     rp = p.close()
     rf = f.close()
     if rp == None: