From 99c8ec16ca741caf94419fa7976525744ce9aed1 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 23 Mar 2021 01:46:51 +0100 Subject: [PATCH] - more python 3.x fixes --- TLD_Builder/chroot.py | 2 +- TLD_Builder/mailer.py | 4 ++-- TLD_Builder/request.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) 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), -- 2.44.0