diff --git a/debian/bin/genorig.py b/debian/bin/genorig.py index b8e5661fd..203ddfebe 100755 --- a/debian/bin/genorig.py +++ b/debian/bin/genorig.py @@ -101,7 +101,7 @@ class Main(object): def debian_patch(self): name = "orig" self.log("Patching source with debian patch (series %s)\n" % name) - fp = file("debian/patches/series-" + name) + fp = open("debian/patches/series-" + name) series = PatchSeries(name, "debian/patches", fp) series(dir=os.path.join(self.dir, self.orig)) @@ -121,7 +121,7 @@ class Main(object): try: if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]): raise RuntimeError("Can't patch source") - os.chmod(out, 0644) + os.chmod(out, 0o644) except: try: os.unlink(out) diff --git a/debian/lib/python/debian_linux/abi.py b/debian/lib/python/debian_linux/abi.py index 1dcf63233..0c4b3bdbc 100644 --- a/debian/lib/python/debian_linux/abi.py +++ b/debian/lib/python/debian_linux/abi.py @@ -37,8 +37,6 @@ class Symbols(dict): self[name] = Symbol(name, module, version, export) def write(self, file): - symbols = self.values() - symbols.sort(key=lambda i: i.name) - for s in symbols: + for s in sorted(self.values(), key=lambda i: i.name): file.write("%s %s %s %s\n" % (s.version, s.name, s.module, s.export)) diff --git a/debian/lib/python/debian_linux/debian.py b/debian/lib/python/debian_linux/debian.py index 120f2e4b8..532b5d3e8 100644 --- a/debian/lib/python/debian_linux/debian.py +++ b/debian/lib/python/debian_linux/debian.py @@ -1,6 +1,7 @@ import collections import itertools import os.path +import six import re from . import utils @@ -35,7 +36,10 @@ class Changelog(list): def __init__(self, dir='', version=None): if version is None: version = Version - f = file(os.path.join(dir, "debian/changelog")) + if six.PY3: + f = open(os.path.join(dir, "debian/changelog"), encoding="UTF-8") + else: + f = open(os.path.join(dir, "debian/changelog")) while True: line = f.readline() if not line: @@ -53,7 +57,7 @@ class Changelog(list): class Version(object): - _version_rules = ur""" + _version_rules = r""" ^ (?: (?P @@ -108,7 +112,7 @@ $ class VersionLinux(Version): - _version_linux_rules = ur""" + _version_linux_rules = r""" ^ (?P \d+\.\d+ @@ -338,7 +342,7 @@ class PackageRelationEntry(object): OP_GT: OP_LE, } - operators_text = dict([(b, a) for a, b in operators.iteritems()]) + operators_text = dict((b, a) for a, b in operators.items()) __slots__ = '_op', @@ -387,14 +391,14 @@ class PackageRelationEntry(object): class Package(dict): _fields = collections.OrderedDict(( - ('Package', unicode), - ('Source', unicode), + ('Package', six.text_type), + ('Source', six.text_type), ('Architecture', PackageArchitecture), - ('Section', unicode), - ('Priority', unicode), - ('Maintainer', unicode), - ('Uploaders', unicode), - ('Standards-Version', unicode), + ('Section', six.text_type), + ('Priority', six.text_type), + ('Maintainer', six.text_type), + ('Uploaders', six.text_type), + ('Standards-Version', six.text_type), ('Build-Depends', PackageRelation), ('Build-Depends-Indep', PackageRelation), ('Provides', PackageRelation), diff --git a/debian/lib/python/debian_linux/patches.py b/debian/lib/python/debian_linux/patches.py index 2f0737b53..2f3168fab 100644 --- a/debian/lib/python/debian_linux/patches.py +++ b/debian/lib/python/debian_linux/patches.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import glob import os import shutil @@ -23,7 +25,7 @@ class Operation(object): s = "OK" else: s = "FAIL" - print """ (%s) %-4s %s""" % (self.operation, s, self.name) + print(""" (%s) %-4s %s""" % (self.operation, s, self.name)) def do(self, dir): raise NotImplementedError @@ -71,7 +73,7 @@ class SubOperation(Operation): s = "OK" else: s = "FAIL" - print """ %-10s %-4s %s""" % ('(%s)' % self.operation, s, self.name) + print(""" %-10s %-4s %s""" % ('(%s)' % self.operation, s, self.name)) class SubOperationFilesRemove(SubOperation): @@ -164,7 +166,7 @@ class PatchSeries(list): if operation in self.operations: f = os.path.join(self.root, filename) - for suffix, cls in (('', file), ('.bz2', BZ2File), ('.gz', GzipFile)): + for suffix, cls in (('', open), ('.bz2', BZ2File), ('.gz', GzipFile)): f1 = f + suffix if os.path.exists(f1): # Must copy current bindings into the lambda-function diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index 9df222f85..0c250ccba 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -46,7 +46,7 @@ Description: Linux kernel API manual pages for version @version@ Package: linux-support-@abiname@ Architecture: all Section: devel -Depends: ${python:Depends}, ${misc:Depends} +Depends: ${python:Depends}, ${misc:Depends}, python-six Multi-Arch: foreign Description: Support files for Linux @upstreamversion@ This package provides support files for the Linux kernel build, diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in index c6c2815e4..0a8af9efd 100644 --- a/debian/templates/control.source.in +++ b/debian/templates/control.source.in @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian Kernel Team Uploaders: Bastian Blank , Frederik Schüler , maximilian attems , Ben Hutchings Standards-Version: 3.9.4 -Build-Depends: debhelper (>> 7), cpio, kmod | module-init-tools, python (>= 2.7), lzma [armel], kernel-wedge (>= 2.84), quilt, patchutils, bc +Build-Depends: debhelper (>> 7), cpio, kmod | module-init-tools, python (>= 2.7), python-six, lzma [armel], kernel-wedge (>= 2.84), quilt, patchutils, bc Build-Depends-Indep: xz-utils, xmlto Vcs-Svn: svn://anonscm.debian.org/svn/kernel/dists/trunk/linux/ Vcs-Browser: http://anonscm.debian.org/viewvc/kernel/dists/trunk/linux/