import sys
from io import StringIO
from config import config
-import util
+import shutil
import log
def recode(s):
self.body.write("\n\n[...]\n\n")
line += 1
else:
- util.sendfile(open(log), self.body)
+ shutil.copyfileobj(open(log), self.body)
def set_std_headers(self):
self.headers["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
f.write("%s: %s\n" % (k, v))
f.write("\n")
self.body.seek(0)
- util.sendfile(self.body, f)
+ shutil.copyfileobj(self.body, f)
def send(self):
if not os.path.exists("/usr/lib/sendmail"):
import status
import lock
import util
+import shutil
import gpg
import request
import loop
log.error("can't fetch %s: %s" % (control_url + "/queue.gz", e))
sys.exit(1)
sio = BytesIO()
- util.sendfile(f, sio)
+ shutil.copyfileobj(f, sio)
f.close()
sio.seek(0)
f = gzip.GzipFile(fileobj = sio)
from bqueue import B_Queue
import lock
import util
+import shutil
import loop
import path
import status
o = chroot.popen("cat > %s" % b.src_rpm, mode = "w")
try:
- bytes = util.sendfile(f, o)
+ shutil.copyfileobj(f, o)
except IOError as e:
b.log_line("error: unable to write to `%s': %s" % (b.src_rpm, e))
raise
+ bytes = f.tell()
f.close()
o.close()
t = time.time() - start