Commit 99e7030a authored by Rafael Monnerat's avatar Rafael Monnerat

move to python3

parent ed735991
......@@ -135,15 +135,15 @@ class task(_task):
return task_gen
def __init__(self, run, depends, provides=(),
__str_or_task = (basestring, _task)):
__str_or_task = (str, _task)):
self.run = run
self.depends = []
f = []
for x in (depends,) if isinstance(depends, __str_or_task) else depends:
(f if isinstance(x, basestring) else self.depends).append(x)
(f if isinstance(x, str) else self.depends).append(x)
f and self.depends.append(files(*f))
self.provides = ((provides,)
if isinstance(provides, basestring) or callable(provides)
if isinstance(provides, str) or callable(provides)
else provides)
self.why = self,
......@@ -177,10 +177,10 @@ class task(_task):
if deps:
self.why = [dep for dep, itime in deps if _otime < itime]
if self.why:
print "# Processing %s: %s -> %s" % (self,
print("# Processing %s: %s -> %s" % (self,
", ".join(map(str, self.depends)),
", ".join("<%s>" % x.__name__ if callable(x) else x
for x in self.provides or "?"))
for x in self.provides or "?")))
if not dry_run:
try:
self.run(self)
......@@ -222,8 +222,8 @@ def main():
tasks = {"__file__": f.name}
exec(compile(f.read(), f.name, "exec"), tasks)
if args.list:
print " ".join(sorted(k for k, v in tasks.iteritems()
if isinstance(v, _task)))
print(" ".join(sorted(k for k, v in tasks.iteritems()
if isinstance(v, _task))))
return
for t in args.task:
if not isinstance(tasks.get(t), _task):
......
......@@ -40,9 +40,9 @@
# If this way of packaging is reused for other software, postinst scripts
# should be implemented.
import os, rfc822, shutil, ssl, time, urllib
import os, email, shutil, ssl, time, urllib.request
from glob import glob
from cStringIO import StringIO
from io import StringIO
from subprocess import check_call
from make import *
from debian.changelog import Changelog
......@@ -86,7 +86,7 @@ def bootstrap(task):
try:
os.utime(task.outputs[1], None)
except OSError:
bootstrap = urllib.urlopen(BOOTSTRAP_URL).read()
bootstrap = urllib.request.urlopen(BOOTSTRAP_URL).read()
mkdir(BUILD + "/download-cache")
with cwd(BUILD):
rmtree("extends-cache")
......@@ -205,7 +205,7 @@ def deb(task):
b["Conflicts"] = b["Provides"] = b["Replaces"] = "re6stnet"
patched_control = StringIO("%s\n%s" % (s, b))
open(task.outputs[1], "w").write(str(d))
date = rfc822.parsedate_tz(Changelog(open(dch.output)).date)
date = email.utils.parsedate_tz(Changelog(open(dch.output)).date)
mtime = time.mktime(date[:9]) - date[9]
# Unfortunately, OBS does not support symlinks.
with make_tar_gz(task.outputs[0], mtime, dereference=True) as t:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment