debian/bin,debian/control,debian/lib/python: Use Python 3

This commit is contained in:
Ben Hutchings 2015-08-29 21:48:39 +01:00
parent 32fff0de75
commit 6b977589fb
10 changed files with 49 additions and 61 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
sys.path.append(sys.path[0] + "/../lib/python")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
sys.path.append('debian/lib/python')

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
sys.path.append("debian/lib/python")
@ -160,9 +160,9 @@ class Gencontrol(Base):
if os.getenv('DEBIAN_KERNEL_DISABLE_INSTALLER'):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn(u'Disable installer modules on request (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
warnings.warn('Disable installer modules on request (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else:
raise RuntimeError(u'Unable to disable installer modules in release build (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
raise RuntimeError('Unable to disable installer modules in release build (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else:
# Add udebs using kernel-wedge
installer_def_dir = 'debian/installer'
@ -344,10 +344,10 @@ class Gencontrol(Base):
if os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn(u'Disable debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG set)')
warnings.warn('Disable debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG set)')
build_debug = False
else:
raise RuntimeError(u'Unable to disable debug infos in release build (DEBIAN_KERNEL_DISABLE_DEBUG set)')
raise RuntimeError('Unable to disable debug infos in release build (DEBIAN_KERNEL_DISABLE_DEBUG set)')
if build_debug:
makeflags['DEBUG'] = True

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
sys.path.append("debian/lib/python")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import optparse
import os.path

1
debian/changelog vendored
View File

@ -14,6 +14,7 @@ linux (4.2~rc8-1~exp2) UNRELEASED; urgency=medium
are redundant with sparc64 and neither is an official port
* Fix last issue that prevents a reproducible build (Closes: #769844):
- DocBook: Use a fixed encoding for output
* debian/bin,debian/control,debian/lib/python: Use Python 3
-- Ben Hutchings <ben@decadent.org.uk> Tue, 25 Aug 2015 18:50:57 +0100

View File

@ -1,8 +1,6 @@
import collections
import os.path
import re
import six
import six.moves
from . import utils
@ -36,10 +34,7 @@ class Changelog(list):
def __init__(self, dir='', version=None):
if version is None:
version = Version
if six.PY3:
f = open(os.path.join(dir, "debian/changelog"), encoding="UTF-8")
else:
f = open(os.path.join(dir, "debian/changelog"))
f = open(os.path.join(dir, "debian/changelog"), encoding="UTF-8")
while True:
line = f.readline()
if not line:
@ -88,7 +83,6 @@ $
def __str__(self):
return self.complete
__unicode__ = __str__
@property
def complete(self):
@ -164,7 +158,7 @@ $
self.linux_version = d['version']
if d['modifier'] is not None:
assert not d['update']
self.linux_upstream = u'-'.join((d['version'], d['modifier']))
self.linux_upstream = '-'.join((d['version'], d['modifier']))
else:
self.linux_upstream = d['version']
self.linux_upstream_full = self.linux_upstream + d['update']
@ -193,8 +187,7 @@ class PackageArchitecture(collections.MutableSet):
return self._data.__len__()
def __str__(self):
return u' '.join(sorted(self))
__unicode__ = __str__
return ' '.join(sorted(self))
def add(self, value):
self._data.add(value)
@ -203,7 +196,7 @@ class PackageArchitecture(collections.MutableSet):
self._data.discard(value)
def extend(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
for i in re.split('\s', value.strip()):
self.add(i)
else:
@ -223,13 +216,12 @@ class PackageDescription(object):
def __str__(self):
wrap = utils.TextWrapper(width=74, fix_sentence_endings=True).wrap
short = u', '.join(self.short)
short = ', '.join(self.short)
long_pars = []
for i in self.long:
long_pars.append(wrap(i))
long = u'\n .\n '.join([u'\n '.join(i) for i in long_pars])
return short + u'\n ' + long
__unicode__ = __str__
long = '\n .\n '.join(['\n '.join(i) for i in long_pars])
return short + '\n ' + long
def append(self, str):
str = str.strip()
@ -255,8 +247,7 @@ class PackageRelation(list):
self.extend(value, override_arches)
def __str__(self):
return u', '.join(six.text_type(i) for i in self)
__unicode__ = __str__
return ', '.join(str(i) for i in self)
def _search_value(self, value):
for i in self:
@ -265,7 +256,7 @@ class PackageRelation(list):
return None
def append(self, value, override_arches=None):
if isinstance(value, six.string_types):
if isinstance(value, str):
value = PackageRelationGroup(value, override_arches)
elif not isinstance(value, PackageRelationGroup):
raise ValueError(u"got %s" % type(value))
@ -276,8 +267,8 @@ class PackageRelation(list):
super(PackageRelation, self).append(value)
def extend(self, value, override_arches=None):
if isinstance(value, six.string_types):
value = (j.strip() for j in re.split(u',', value.strip()))
if isinstance(value, str):
value = (j.strip() for j in re.split(',', value.strip()))
for i in value:
self.append(i, override_arches)
@ -288,31 +279,30 @@ class PackageRelationGroup(list):
self.extend(value, override_arches)
def __str__(self):
return u' | '.join(six.text_type(i) for i in self)
__unicode__ = __str__
return ' | '.join(str(i) for i in self)
def _search_value(self, value):
for i, j in six.moves.zip(self, value):
for i, j in zip(self, value):
if i.name != j.name or i.version != j.version:
return None
return self
def _update_arches(self, value):
for i, j in six.moves.zip(self, value):
for i, j in zip(self, value):
if i.arches:
for arch in j.arches:
if arch not in i.arches:
i.arches.append(arch)
def append(self, value, override_arches=None):
if isinstance(value, six.string_types):
if isinstance(value, str):
value = PackageRelationEntry(value, override_arches)
elif not isinstance(value, PackageRelationEntry):
raise ValueError
super(PackageRelationGroup, self).append(value)
def extend(self, value, override_arches=None):
if isinstance(value, six.string_types):
if isinstance(value, str):
value = (j.strip() for j in re.split('\|', value.strip()))
for i in value:
self.append(i, override_arches)
@ -332,12 +322,12 @@ class PackageRelationEntry(object):
OP_GT = 6
operators = {
u'<<': OP_LT,
u'<=': OP_LE,
u'=': OP_EQ,
u'!=': OP_NE,
u'>=': OP_GE,
u'>>': OP_GT,
'<<': OP_LT,
'<=': OP_LE,
'=': OP_EQ,
'!=': OP_NE,
'>=': OP_GE,
'>>': OP_GT,
}
operators_neg = {
@ -361,10 +351,9 @@ class PackageRelationEntry(object):
def __str__(self):
return self.operators_text[self._op]
__unicode__ = __str__
def __init__(self, value=None, override_arches=None):
if not isinstance(value, six.string_types):
if not isinstance(value, str):
raise ValueError
self.parse(value)
@ -375,11 +364,10 @@ class PackageRelationEntry(object):
def __str__(self):
ret = [self.name]
if self.operator is not None and self.version is not None:
ret.extend((u' (', six.text_type(self.operator), u' ', self.version, u')'))
ret.extend((' (', str(self.operator), ' ', self.version, ')'))
if self.arches:
ret.extend((u' [', u' '.join(self.arches), u']'))
return u''.join(ret)
__unicode__ = __str__
ret.extend((' [', ' '.join(self.arches), ']'))
return ''.join(ret)
def parse(self, value):
match = self._re.match(value)
@ -400,14 +388,14 @@ class PackageRelationEntry(object):
class Package(dict):
_fields = collections.OrderedDict((
('Package', six.text_type),
('Source', six.text_type),
('Package', str),
('Source', str),
('Architecture', PackageArchitecture),
('Section', six.text_type),
('Priority', six.text_type),
('Maintainer', six.text_type),
('Uploaders', six.text_type),
('Standards-Version', six.text_type),
('Section', str),
('Priority', str),
('Maintainer', str),
('Uploaders', str),
('Standards-Version', str),
('Build-Depends', PackageRelation),
('Build-Depends-Indep', PackageRelation),
('Provides', PackageRelation),

View File

@ -1,5 +1,4 @@
import codecs
import six
from collections import OrderedDict
from .debian import *
@ -141,7 +140,7 @@ class Gencontrol(object):
cmds = []
for i in extra_arches[arch]:
cmds.append("$(MAKE) -f debian/rules.real install-dummy ARCH='%s' DH_OPTIONS='-p%s'" % (arch, i['Package']))
makefile.add('binary-arch_%s' % arch, [u'binary-arch_%s_extra' % arch])
makefile.add('binary-arch_%s' % arch, ['binary-arch_%s_extra' % arch])
makefile.add("binary-arch_%s_extra" % arch, cmds = cmds)
def do_arch(self, packages, makefile, arch, vars, makeflags, extra):
@ -275,7 +274,7 @@ class Gencontrol(object):
def subst(match):
return vars[match.group(1)]
return re.sub(r'@([-_a-z0-9]+)@', subst, six.text_type(s))
return re.sub(r'@([-_a-z0-9]+)@', subst, str(s))
def write(self, packages, makefile):
self.write_control(packages.values())
@ -298,4 +297,4 @@ class Gencontrol(object):
for entry in list:
for key, value in entry.iteritems():
f.write(u"%s: %s\n" % (key, value))
f.write(u'\n')
f.write('\n')

View File

@ -58,11 +58,11 @@ def read_control(f):
break
if line[0] in ' \t':
if not last:
raise ValueError(u'Continuation line seen before first header')
raise ValueError('Continuation line seen before first header')
lines.append(line.lstrip())
continue
if last:
e[last] = u'\n'.join(lines)
e[last] = '\n'.join(lines)
i = line.find(':')
if i < 0:
raise ValueError(u"Not a header, not a continuation: ``%s''" % line)

View File

@ -3,7 +3,7 @@ Priority: optional
Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
Uploaders: Bastian Blank <waldi@debian.org>, maximilian attems <maks@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Standards-Version: 3.9.5
Build-Depends: debhelper, cpio, kmod, python, python-six, xz-utils, kernel-wedge, quilt, patchutils, bc
Build-Depends: debhelper, cpio, kmod, python3, xz-utils, kernel-wedge, quilt, patchutils, bc
Build-Depends-Indep: xmlto
Vcs-Git: https://anonscm.debian.org/git/kernel/linux.git
Vcs-Browser: https://anonscm.debian.org/cgit/kernel/linux.git