From: Marcin Krol Date: Tue, 23 Mar 2021 00:46:51 +0000 (+0100) Subject: - more python 3.x fixes X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=99c8ec16ca741caf94419fa7976525744ce9aed1;p=tld-builder.git - more python 3.x fixes --- diff --git a/TLD_Builder/chroot.py b/TLD_Builder/chroot.py index a489ac3..f91e1c6 100644 --- a/TLD_Builder/chroot.py +++ b/TLD_Builder/chroot.py @@ -49,7 +49,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))) + m.update(str(random.sample(range(100000), 500)).encode('utf-8')) digest = m.hexdigest() marker_start = "--- FILE BEGIN DIGEST %s ---" % digest diff --git a/TLD_Builder/mailer.py b/TLD_Builder/mailer.py index a0e1bb5..7725a60 100644 --- a/TLD_Builder/mailer.py +++ b/TLD_Builder/mailer.py @@ -14,9 +14,9 @@ import log def recode(s): if s.__class__ == ''.__class__: - return s.decode('iso-8859-1', 'replace').encode('us-ascii', 'replace') + return s.encode('iso-8859-1', 'replace').decode('us-ascii', 'replace') else: - return s.encode('us-ascii', 'replace') + return s.decode('us-ascii', 'replace') class Message: def __init__(self): diff --git a/TLD_Builder/request.py b/TLD_Builder/request.py index 149557a..7638bf2 100644 --- a/TLD_Builder/request.py +++ b/TLD_Builder/request.py @@ -11,6 +11,7 @@ import urllib import cgi import pytz import tempfile +import subprocess import util import log @@ -329,7 +330,7 @@ class Batch: desc = "SH:
%s
flags: [%s]" % (self.command, ' '.join(self.command_flags)) else: cmd = "/usr/bin/git ls-remote --heads git://git.tld-linux.org/packages/%s 1>/dev/null 2>&1" % (self.spec[:-5]) - r = call(cmd, shell=True) + r = subprocess.call(cmd, shell=True) if r == 0: package_url = "http://git.tld-linux.org/?p=packages/%(package)s.git;a=blob;f=%(spec)s;hb=%(branch)s" % { 'spec': urllib.quote(self.spec),