diff -Nru python-apt-0.9.3.2/aptsources/sourceslist.py python-apt-0.9.3.2ubuntu2/aptsources/sourceslist.py --- python-apt-0.9.3.2/aptsources/sourceslist.py 2014-03-10 13:35:08.000000000 +0000 +++ python-apt-0.9.3.2ubuntu2/aptsources/sourceslist.py 2014-03-14 21:18:49.000000000 +0000 @@ -31,6 +31,7 @@ import re import shutil import time +import io import apt_pkg from .distinfo import DistInfo @@ -234,25 +235,26 @@ """ return the current line as string """ if self.invalid: return self.line - line = "" + line = u"" if self.disabled: - line = "# " + line = u"# " line += self.type if self.architectures and self.trusted is not None: - line += " [arch=%s trusted=%s]" % ( - ",".join(self.architectures), "yes" if self.trusted else "no") + line += u" [arch=%s trusted=%s]" % ( + u",".join(self.architectures), + u"yes" if self.trusted else u"no") elif self.trusted is not None: - line += " [trusted=%s]" % ("yes" if self.trusted else "no") + line += u" [trusted=%s]" % (u"yes" if self.trusted else u"no") elif self.architectures: - line += " [arch=%s]" % ",".join(self.architectures) - line += " %s %s" % (self.uri, self.dist) + line += u" [arch=%s]" % u",".join(self.architectures) + line += u" %s %s" % (self.uri, self.dist) if len(self.comps) > 0: - line += " " + " ".join(self.comps) + line += u" " + u" ".join(self.comps) if self.comment != "": - line += " #" + self.comment - line += "\n" + line += u" #" + self.comment + line += u"\n" return line @@ -343,13 +345,13 @@ # there isn't any matching source, so create a new line and parse it line = type if architectures: - line += " [arch=%s]" % ",".join(architectures) - line += " %s %s" % (uri, dist) + line += u" [arch=%s]" % u",".join(architectures) + line += u" %s %s" % (uri, dist) for c in comps: - line = line + " " + c + line = line + u" " + c if comment != "": - line = "%s #%s\n" % (line, comment) - line = line + "\n" + line = u"%s #%s\n" % (line, comment) + line = line + u"\n" new_entry = SourceEntry(line) if file is not None: new_entry.file = file @@ -387,7 +389,7 @@ def load(self, file): """ (re)load the current sources """ try: - with open(file, "r") as f: + with io.open(file, "r", encoding="utf-8") as f: for line in f: source = SourceEntry(line, file) self.list.append(source) @@ -405,14 +407,15 @@ "# Remember that you can only use http, ftp or file URIs\n" "# CDROMs are managed through the apt-cdrom tool.\n") - with open(path, "w") as f: + with io.open(path, "w", encoding="utf-8") as f: f.write(header) return try: for source in self.list: if source.file not in files: - files[source.file] = open(source.file, "w") + files[source.file] = io.open(source.file, "w", + encoding="utf-8") files[source.file].write(source.str()) finally: for f in files: diff -Nru python-apt-0.9.3.2/debian/changelog python-apt-0.9.3.2ubuntu2/debian/changelog --- python-apt-0.9.3.2/debian/changelog 2014-03-10 13:35:08.000000000 +0000 +++ python-apt-0.9.3.2ubuntu2/debian/changelog 2014-03-14 21:21:04.000000000 +0000 @@ -1,3 +1,19 @@ +python-apt (0.9.3.2ubuntu2) trusty; urgency=medium + + * Fix pep8 error. + + -- Brian Murray Fri, 14 Mar 2014 14:20:43 -0700 + +python-apt (0.9.3.2ubuntu1) trusty; urgency=medium + + [ Steve Langasek ] + * aptsources/sourceslist.py: ensure that our sources are opened with UTF-8 + encoding, regardless of the current locale, and handle the sources lines + as Unicode internally for consistency between python2 and python3. + LP: #1069019. + + -- Brian Murray Fri, 14 Mar 2014 13:19:27 -0700 + python-apt (0.9.3.2) unstable; urgency=high * Revert "* apt/cache.py:" (rootdir change) (Closes: #741251) (LP: #1288171) diff -Nru python-apt-0.9.3.2/debian/control python-apt-0.9.3.2ubuntu2/debian/control --- python-apt-0.9.3.2/debian/control 2014-03-10 13:35:08.000000000 +0000 +++ python-apt-0.9.3.2ubuntu2/debian/control 2014-03-14 20:23:14.000000000 +0000 @@ -1,7 +1,8 @@ Source: python-apt Section: python Priority: standard -Maintainer: APT Development Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode Standards-Version: 3.9.5 XS-Python-Version: >= 2.7