Debian Bug report logs - #625509
python-debian: please port to Py3k

version graph

Package: python-debian; Maintainer for python-debian is Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>; Source for python-debian is src:python-debian (PTS, buildd, popcon).

Reported by: Tshepang Lekhonkhobe <tshepang@gmail.com>

Date: Wed, 4 May 2011 01:15:01 UTC

Severity: normal

Found in version python-debian/0.1.20

Fixed in version python-debian/0.1.21+nmu1

Done: Colin Watson <cjwatson@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 04 May 2011 01:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to Tshepang Lekhonkhobe <tshepang@gmail.com>:
New Bug report received and forwarded. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 04 May 2011 01:15:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Tshepang Lekhonkhobe <tshepang@gmail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: python-debian: please port to Py3k
Date: Wed, 04 May 2011 03:10:29 +0200
Package: python-debian
Version: 0.1.20
Severity: normal

Can you either make this package capable of running for Python 2 and 3,
or make separate packages for it, as python-apt does.

For one, python-apt disables at least one of its tests because of this
lack. Also, I would like to use it in wajig, whose next upload should
be Py3k-powered (port lives in VCS).




Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 18 Jan 2012 10:57:14 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 18 Jan 2012 10:57:53 GMT) (full text, mbox, link).


Message #10 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@ubuntu.com>
To: Tshepang Lekhonkhobe <tshepang@gmail.com>, 625509@bugs.debian.org
Subject: Re: Bug#625509: python-debian: please port to Py3k
Date: Wed, 18 Jan 2012 10:54:28 +0000
On Wed, May 04, 2011 at 03:10:29AM +0200, Tshepang Lekhonkhobe wrote:
> Can you either make this package capable of running for Python 2 and 3,
> or make separate packages for it, as python-apt does.

I'm working on this here:

  http://anonscm.debian.org/gitweb/?p=users/cjwatson/python-debian.git;a=shortlog;h=refs/heads/python3

I will probably end up depending on the six module, which I uploaded to
unstable yesterday.  It's tiny, so I shouldn't expect this to cause much
of a problem.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656288 in python3-apt
is getting in the way a bit, but I suppose worst case I can just skip
those tests when running under Python 3 for now.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]




Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Sun, 22 Jan 2012 14:42:03 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Sun, 22 Jan 2012 14:42:03 GMT) (full text, mbox, link).


Message #15 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@ubuntu.com>
To: Tshepang Lekhonkhobe <tshepang@gmail.com>, 625509@bugs.debian.org
Cc: Julian Andres Klode <jak@debian.org>, 656288@bugs.debian.org
Subject: Re: Bug#625509: python-debian: please port to Py3k
Date: Sun, 22 Jan 2012 14:37:55 +0000
[Message part 1 (text/plain, inline)]
On Wed, Jan 18, 2012 at 10:54:28AM +0000, Colin Watson wrote:
> On Wed, May 04, 2011 at 03:10:29AM +0200, Tshepang Lekhonkhobe wrote:
> > Can you either make this package capable of running for Python 2 and 3,
> > or make separate packages for it, as python-apt does.
> 
> I'm working on this here:
> 
>   http://anonscm.debian.org/gitweb/?p=users/cjwatson/python-debian.git;a=shortlog;h=refs/heads/python3
> 
> I will probably end up depending on the six module, which I uploaded to
> unstable yesterday.  It's tiny, so I shouldn't expect this to cause much
> of a problem.
> 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656288 in python3-apt
> is getting in the way a bit, but I suppose worst case I can just skip
> those tests when running under Python 3 for now.

I believe this port is now complete, in the git branch above.  It passes
all tests provided that a version of python3-apt with the most recent
patch in #656288 is available.

I would very much appreciate review of this branch.  In case it eases
review, I've attached the 31-patch series (!) to this mail.  I've tried
to arrange it roughly in ascending order of complexity.

Cheers,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
[0001-Fix-test-warnings-with-python2.7-3.patch (text/x-diff, attachment)]
[0002-Avoid-various-old-syntactic-forms-which-are-no-longe.patch (text/x-diff, attachment)]
[0003-Use-Python-3-style-print-function.patch (text/x-diff, attachment)]
[0004-Use-a-list-comprehension-instead-of-map-which-return.patch (text/x-diff, attachment)]
[0005-Use-iterkeys-iteritems-when-an-iterator-is-all-we-ne.patch (text/x-diff, attachment)]
[0006-Use-absolute-imports.patch (text/x-diff, attachment)]
[0007-Use-Python-3-style-print-function-in-examples.patch (text/x-diff, attachment)]
[0008-Use-key-in-dict-rather-than-obsolete-dict.has_key-ke.patch (text/x-diff, attachment)]
[0009-Use-open-rather-than-file-file-does-not-exist-in-Pyt.patch (text/x-diff, attachment)]
[0010-Use-sep.join-list-rather-than-string.join-list-sep.patch (text/x-diff, attachment)]
[0011-Implement-rich-comparison-methods-the-only-kind-avai.patch (text/x-diff, attachment)]
[0012-Use-assertTrue-and-assertEquals-rather-than-deprecat.patch (text/x-diff, attachment)]
[0013-Try-to-import-pickle-if-importing-cPickle-fails.-Pyt.patch (text/x-diff, attachment)]
[0014-Use-io.StringIO-if-StringIO.StringIO-is-absent-as-in.patch (text/x-diff, attachment)]
[0015-Use-collections.Mapping-collections.MutableMapping-i.patch (text/x-diff, attachment)]
[0016-Use-list-comprehensions-instead-of-map-where-a-list-.patch (text/x-diff, attachment)]
[0017-If-StandardError-does-not-exist-as-in-Python-3-inher.patch (text/x-diff, attachment)]
[0018-Use-six-to-paper-over-dict-iteration-differences-bet.patch (text/x-diff, attachment)]
[0019-Use-six-to-paper-over-int-long-differences-between-P.patch (text/x-diff, attachment)]
[0020-Cope-with-the-absence-of-a-file-class-in-Python-3.patch (text/x-diff, attachment)]
[0021-Python-3-renamed-raw_input-to-input.patch (text/x-diff, attachment)]
[0022-Be-much-more-careful-about-closing-files-in-a-timely.patch (text/x-diff, attachment)]
[0023-Use-six-to-paper-over-iterator.next-vs.-next-iterato.patch (text/x-diff, attachment)]
[0024-Use-string.ascii_letters-rather-than-the-deprecated-.patch (text/x-diff, attachment)]
[0025-In-Python-3-encode-Unicode-strings-before-passing-th.patch (text/x-diff, attachment)]
[0026-Fix-up-debian.changelog-for-string-handling-changes-.patch (text/x-diff, attachment)]
[0027-Only-define-DebPart.has_key-method-for-Python-2.patch (text/x-diff, attachment)]
[0028-Fix-up-debian.arfile-and-debian.debfile-for-string-h.patch (text/x-diff, attachment)]
[0029-Fix-up-most-of-debian.deb822-for-string-handling-cha.patch (text/x-diff, attachment)]
[0030-Fix-up-the-rest-of-debian.deb822-for-Python-3-string.patch (text/x-diff, attachment)]
[0031-Add-a-python3-debian-package.patch (text/x-diff, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Mon, 23 Jan 2012 00:30:06 GMT) (full text, mbox, link).


Acknowledgement sent to John Wright <jsw@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Mon, 23 Jan 2012 00:30:06 GMT) (full text, mbox, link).


Message #20 received at 625509@bugs.debian.org (full text, mbox, reply):

From: John Wright <jsw@debian.org>
To: Colin Watson <cjwatson@ubuntu.com>, 625509@bugs.debian.org
Cc: Tshepang Lekhonkhobe <tshepang@gmail.com>, Julian Andres Klode <jak@debian.org>, 656288@bugs.debian.org
Subject: Re: Bug#625509: python-debian: please port to Py3k
Date: Sun, 22 Jan 2012 16:21:41 -0800
On Sun, Jan 22, 2012 at 02:37:55PM +0000, Colin Watson wrote:
> On Wed, Jan 18, 2012 at 10:54:28AM +0000, Colin Watson wrote:
> > On Wed, May 04, 2011 at 03:10:29AM +0200, Tshepang Lekhonkhobe wrote:
> > > Can you either make this package capable of running for Python 2 and 3,
> > > or make separate packages for it, as python-apt does.
> > 
> > I'm working on this here:
> > 
> >   http://anonscm.debian.org/gitweb/?p=users/cjwatson/python-debian.git;a=shortlog;h=refs/heads/python3
> > 
> > I will probably end up depending on the six module, which I uploaded to
> > unstable yesterday.  It's tiny, so I shouldn't expect this to cause much
> > of a problem.
> > 
> > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656288 in python3-apt
> > is getting in the way a bit, but I suppose worst case I can just skip
> > those tests when running under Python 3 for now.
> 
> I believe this port is now complete, in the git branch above.  It passes
> all tests provided that a version of python3-apt with the most recent
> patch in #656288 is available.
> 
> I would very much appreciate review of this branch.  In case it eases
> review, I've attached the 31-patch series (!) to this mail.  I've tried
> to arrange it roughly in ascending order of complexity.

Wow.  I'll be glad to review them, but I'm not sure when I'll have the
opportunity.  I'll try to make time later this week.

Thanks for the effort!

-- 
John Wright <jsw@debian.org>




Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 14 Mar 2012 16:09:04 GMT) (full text, mbox, link).


Acknowledgement sent to Stefano Zacchiroli <zack@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 14 Mar 2012 16:09:04 GMT) (full text, mbox, link).


Message #25 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Stefano Zacchiroli <zack@debian.org>
To: John Wright <jsw@debian.org>, 625509@bugs.debian.org
Cc: Colin Watson <cjwatson@ubuntu.com>, Tshepang Lekhonkhobe <tshepang@gmail.com>, 656288@bugs.debian.org, Julian Andres Klode <jak@debian.org>
Subject: Re: Bug#625509: python-debian: please port to Py3k
Date: Wed, 14 Mar 2012 17:06:51 +0100
[Message part 1 (text/plain, inline)]
On Sun, Jan 22, 2012 at 04:21:41PM -0800, John Wright wrote:
> On Sun, Jan 22, 2012 at 02:37:55PM +0000, Colin Watson wrote:
> > I would very much appreciate review of this branch.  In case it eases
> > review, I've attached the 31-patch series (!) to this mail.  I've tried
> > to arrange it roughly in ascending order of complexity.
> 
> Wow.  I'll be glad to review them, but I'm not sure when I'll have the
> opportunity.  I'll try to make time later this week.

Heya John,
  do you think you'll have time to do the review in the near future?
Just a friendly ping because, unfortunately, I haven't yet look in
enough details to Python 3 to be able to do a review myself.

Still, I'd love to see python-debian porting to python 3 in the archive
... and I'll be happy to test early versions!

TIA,
Cheers.
-- 
Stefano Zacchiroli     zack@{upsilon.cc,pps.jussieu.fr,debian.org} . o .
Maître de conférences   ......   http://upsilon.cc/zack   ......   . . o
Debian Project Leader    .......   @zack on identi.ca   .......    o o o
« the first rule of tautology club is the first rule of tautology club »
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Mon, 19 Mar 2012 04:09:03 GMT) (full text, mbox, link).


Acknowledgement sent to John Wright <jsw@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Mon, 19 Mar 2012 04:09:03 GMT) (full text, mbox, link).


Message #30 received at 625509@bugs.debian.org (full text, mbox, reply):

From: John Wright <jsw@debian.org>
To: Stefano Zacchiroli <zack@debian.org>, 625509@bugs.debian.org
Cc: Tshepang Lekhonkhobe <tshepang@gmail.com>, 656288@bugs.debian.org, Colin Watson <cjwatson@ubuntu.com>, Julian Andres Klode <jak@debian.org>
Subject: Re: Bug#625509: python-debian: please port to Py3k
Date: Sun, 18 Mar 2012 21:02:29 -0700
On Wed, Mar 14, 2012 at 05:06:51PM +0100, Stefano Zacchiroli wrote:
> On Sun, Jan 22, 2012 at 04:21:41PM -0800, John Wright wrote:
> > On Sun, Jan 22, 2012 at 02:37:55PM +0000, Colin Watson wrote:
> > > I would very much appreciate review of this branch.  In case it eases
> > > review, I've attached the 31-patch series (!) to this mail.  I've tried
> > > to arrange it roughly in ascending order of complexity.
> > 
> > Wow.  I'll be glad to review them, but I'm not sure when I'll have the
> > opportunity.  I'll try to make time later this week.
> 
> Heya John,
>   do you think you'll have time to do the review in the near future?
> Just a friendly ping because, unfortunately, I haven't yet look in
> enough details to Python 3 to be able to do a review myself.

I also don't know when I'll have time...  I thought I would a couple of
months ago, but things aren't getting any less busy.  :-(  I also need
to take some time to familiarize myself with Python 3.

> Still, I'd love to see python-debian porting to python 3 in the archive
> ... and I'll be happy to test early versions!

I'll see how many patches I can review next weekend.  Maybe it'll be
worth making an upload to experimental for testing beyond our unit
tests.

-- 
John Wright <jsw@debian.org>




Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Mon, 19 Mar 2012 14:36:03 GMT) (full text, mbox, link).


Acknowledgement sent to Stefano Zacchiroli <zack@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Mon, 19 Mar 2012 14:36:04 GMT) (full text, mbox, link).


Message #35 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Stefano Zacchiroli <zack@debian.org>
To: John Wright <jsw@debian.org>, 625509@bugs.debian.org
Cc: Tshepang Lekhonkhobe <tshepang@gmail.com>, 656288@bugs.debian.org, Colin Watson <cjwatson@ubuntu.com>, Julian Andres Klode <jak@debian.org>
Subject: Re: Bug#625509: python-debian: please port to Py3k
Date: Mon, 19 Mar 2012 15:33:11 +0100
[Message part 1 (text/plain, inline)]
On Sun, Mar 18, 2012 at 09:02:29PM -0700, John Wright wrote:
> > Still, I'd love to see python-debian porting to python 3 in the archive
> > ... and I'll be happy to test early versions!
> 
> I'll see how many patches I can review next weekend.  Maybe it'll be
> worth making an upload to experimental for testing beyond our unit
> tests.

That would be a good idea indeed.  Having the package there would allow
to call for testing more easily, and will also expedite the final upload
since the package will have to go through a round of (binary) NEW.

TIA,
Cheers.
-- 
Stefano Zacchiroli     zack@{upsilon.cc,pps.jussieu.fr,debian.org} . o .
Maître de conférences   ......   http://upsilon.cc/zack   ......   . . o
Debian Project Leader    .......   @zack on identi.ca   .......    o o o
« the first rule of tautology club is the first rule of tautology club »
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Thu, 26 Apr 2012 21:51:04 GMT) (full text, mbox, link).


Acknowledgement sent to Barry Warsaw <barry@python.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>.

Your message did not contain a Subject field. They are recommended and useful because the title of a $gBug is determined using this field. Please remember to include a Subject field in your messages in future.

(Thu, 26 Apr 2012 21:51:04 GMT) (full text, mbox, link).


Message #40 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Barry Warsaw <barry@python.org>
To: 625509@bugs.debian.org
Date: Thu, 26 Apr 2012 17:39:03 -0400
[Message part 1 (text/plain, inline)]
I'm starting to review and test Colin's patches.  Here are some comments.
Where I don't mention anything (the majority of the code), then I think it
looks great.

Meta-question: do you think it makes sense to turn on `from __future__ import
unicode_literals`?

0002-Avoid-various

diff --git a/lib/debian/deb822.py b/lib/debian/deb822.py
index 7e8d0a6..f838da8 100644
--- a/lib/debian/deb822.py
+++ b/lib/debian/deb822.py
@@ -234,8 +234,8 @@ class Deb822Dict(object, UserDict.DictMixin):
         return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self.items()])
 
     def __eq__(self, other):
-        mykeys = self.keys(); mykeys.sort()
-        otherkeys = other.keys(); otherkeys.sort()
+        mykeys = sorted(self.keys())
+        otherkeys = sorted(other.keys())
         if not mykeys == otherkeys:
             return False
 
While the above code is fine, a perhaps more idiomatic way of writing it would
be:

    mykeys = sorted(self)
    otherkeys = sorted(other)

since .keys() is the default iteration protocol for mappings.

diff --git a/lib/debian/debian_support.py b/lib/debian/debian_support.py
index f0577ac..a5d5a3d 100644
--- a/lib/debian/debian_support.py
+++ b/lib/debian/debian_support.py
@@ -53,9 +53,9 @@ class ParseError(Exception):
         return self.msg
 
     def __repr__(self):
-        return "ParseError(%s, %d, %s)" % (`self.filename`,
+        return "ParseError(%s, %d, %s)" % (repr(self.filename),
                                            self.lineno,
-                                           `self.msg`)
+                                           repr(self.msg))
 
     def print_out(self, file):
         """Writes a machine-parsable error message to file."""
@@ -337,7 +337,7 @@ class PseudoEnum:
         self._name = name
         self._order = order
     def __repr__(self):
-        return '%s(%s)'% (self.__class__._name__, `name`)
+        return '%s(%s)'% (self.__class__._name__, repr(name))
     def __str__(self):
         return self._name
     def __cmp__(self, other):
@@ -392,7 +392,7 @@ def patches_from_ed_script(source,
     for line in i:
         match = re_cmd.match(line)
         if match is None:
-            raise ValueError, "invalid patch command: " + `line`
+            raise ValueError("invalid patch command: " + repr(line))
 
         (first, last, cmd) = match.groups()
         first = int(first)
@@ -561,7 +561,7 @@ def update_file(remote, local, verbose=None):
                 continue
             
             if verbose:
-                print "update_file: field %s ignored" % `field`
+                print "update_file: field %s ignored" % repr(field)
         
     if not patches_to_apply:
         if verbose:
@@ -569,17 +569,17 @@ def update_file(remote, local, verbose=None):
         return download_file(remote, local)
 
     for patch_name in patches_to_apply:
-        print "update_file: downloading patch " + `patch_name`
+        print "update_file: downloading patch " + repr(patch_name)
         patch_contents = download_gunzip_lines(remote + '.diff/' + patch_name
                                           + '.gz')
-        if read_lines_sha1(patch_contents ) <> patch_hashes[patch_name]:
-            raise ValueError, "patch %s was garbled" % `patch_name`
+        if read_lines_sha1(patch_contents ) != patch_hashes[patch_name]:
+            raise ValueError("patch %s was garbled" % repr(patch_name))
         patch_lines(lines, patches_from_ed_script(patch_contents))
         
     new_hash = read_lines_sha1(lines)
-    if new_hash <> remote_hash:
-        raise ValueError, ("patch failed, got %s instead of %s"
-                           % (new_hash, remote_hash))
+    if new_hash != remote_hash:
+        raise ValueError("patch failed, got %s instead of %s"
+                         % (new_hash, remote_hash))
 
     replace_file(lines, local)
     return lines

You might consider using %r in these cases, which calls the repr() of the
object for string interpolation.  E.g. 

    def __repr__(self):
        return '%s(%r)'% (self.__class__._name__, name)

Note though in that example, 'name' is undefined here.  I'm guessing you meant
self._name.

@@ -593,8 +593,6 @@ def merge_as_sets(*args):
     for x in args:
         for y in x:
             s[y] = True
-    l = s.keys()
-    l.sort()
-    return l
+    return sorted(s.keys())
 
Again, you can probably just `return sorted(s)`

0003-Use-Python-3-style-print

diff --git a/lib/debian/arfile.py b/lib/debian/arfile.py
diff --git a/lib/debian/debfile.py b/lib/debian/debfile.py
diff --git a/lib/debian/debian_support.py b/lib/debian/debian_support.py
diff --git a/lib/debian/debtags.py b/lib/debian/debtags.py
diff --git a/lib/debian/doc-debtags b/lib/debian/doc-debtags

You need to add `from __future__ import print_function` to these files.

0005-Use-iterkeys

Why make these changes, given that .iterkeys() and .iteritems() doesn't exist
in Python 3?  I see later you use `six` for Python version compatibility, but
why not just use .keys() and .items() instead?  Are these collections so big
that making concrete lists in Python 2 will cause serious memory pressure?

0006-Use-absolute

I like this change a lot!  Would it make sense to add a __future__ import of
absolute_import too?

0007-Use-Python-3-style-print

This patch is also inconsistent about adding from __future__ import
print_function.  It should add them to all the files where print() is being
used.

0011-Implement-rich

This looks fine.  If you wanted to, and you can support nothing less that
Python 2.7 (not yet true for Debian), then you could define just __lt__ and
__eq__ and let the @functools.total_ordering class decorator fill in the
rest.  Just FYI.

0019-Use-six-to-paper-over-int-long

My suspicion is that because all you care about is 0L here, you probably don't
need six for that.  IOW, you could just return 0 without coercing to long().
I haven't tested that though.

0022-Be-much-more-careful

diff --git a/tests/test_deb822.py b/tests/test_deb822.py
index eae7418..d44477e 100755
--- a/tests/test_deb822.py
+++ b/tests/test_deb822.py
@@ -757,8 +763,10 @@ Description: python modules to work with Debian-related data formats
         warnings.filterwarnings(action='ignore', category=UnicodeWarning)
 
         filename = 'test_Sources.mixed_encoding'
-        for paragraphs in [deb822.Sources.iter_paragraphs(open(filename)),
-                           deb822.Sources.iter_paragraphs(open(filename),
+        f1 = open(filename, 'rb')
+        f2 = open(filename, 'rb')
+        for paragraphs in [deb822.Sources.iter_paragraphs(f1),
+                           deb822.Sources.iter_paragraphs(f2,
                                                           use_apt_pkg=False)]:
             p1 = paragraphs.next()
             self.assertEqual(p1['maintainer'],
@@ -766,6 +774,8 @@ Description: python modules to work with Debian-related data formats
             p2 = paragraphs.next()
             self.assertEqual(p2['uploaders'],
                              u'Frank Küster <frank@debian.org>')
+        f2.close()
+        f1.close()
 
     def test_bug597249_colon_as_first_value_character(self):
         """Colon should be allowed as the first value character. See #597249.

It's a test, so this doesn't bother me too much, and also because while you
could use contextlib.nested() in Python 2, that doesn't exist in Python 3.
There, and in Python 2.7, the with-statement itself supports multiple context
managers, so you could write:

    with open(filename, 'rb') as f1, open(filename, 'rb') as f2:

Unfortunately, that doesn't work in Python 2.6. :(

0023-Use-six-to-paper-over-iterator.next

I think this is unnecessary.  Built-in next() appeared in Python 2.6, and it's
available in 2.7 and 3.2 also.  So instead of calling
e.g. `sequence_iter.next()` or `six.advance_iterator(sequence_iter)` you can
just call `next(sequence_iter)` everywhere.

That's it for now.  I'm going to do some additional testing and will follow up
if I find anything.  Otherwise, I'd say, go for it.  Even without the few
minor comments above, Colin's patch is fantastic.
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 13 Jun 2012 17:30:07 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 13 Jun 2012 17:30:07 GMT) (full text, mbox, link).


Message #45 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@ubuntu.com>
To: Barry Warsaw <barry@python.org>, 625509@bugs.debian.org
Subject: Re: Bug#625509: (no subject)
Date: Wed, 13 Jun 2012 18:26:28 +0100
[Message part 1 (text/plain, inline)]
On Thu, Apr 26, 2012 at 05:39:03PM -0400, Barry Warsaw wrote:
> I'm starting to review and test Colin's patches.  Here are some comments.
> Where I don't mention anything (the majority of the code), then I think it
> looks great.

Likewise, where I don't mention anything, it's because I've addressed
your concerns more or less as stated.

> Meta-question: do you think it makes sense to turn on `from __future__ import
> unicode_literals`?

We've talked about this on a few occasions. :-)

This is more or less the poster child for a case where I think
unicode_literals is difficult.  There's a complex API which is quite
sensitive to whether things are bytes or unicode in places, and often
handles both.  The tests need to check whether both are handled.  It
interacts with several other interfaces that prefer to work with bytes
in Python 2 but Unicode strings in Python 3.

In short, I did try, but I found it to be much more complicated to try
to shift to unicode_literals than it was worth, and I really wasn't
confident enough in absolute 100% test coverage to be certain I hadn't
broken anything.

> 0003-Use-Python-3-style-print
> 
> diff --git a/lib/debian/arfile.py b/lib/debian/arfile.py
> diff --git a/lib/debian/debfile.py b/lib/debian/debfile.py
> diff --git a/lib/debian/debian_support.py b/lib/debian/debian_support.py
> diff --git a/lib/debian/debtags.py b/lib/debian/debtags.py
> diff --git a/lib/debian/doc-debtags b/lib/debian/doc-debtags
> 
> You need to add `from __future__ import print_function` to these files.

Technically not in all of them since a single-element tuple prints the
same way as its element. :-)  But that wasn't in the case in all of
them, and that assumption is fragile in any case, so I've made this
change.

> 0005-Use-iterkeys
> 
> Why make these changes, given that .iterkeys() and .iteritems() doesn't exist
> in Python 3?  I see later you use `six` for Python version compatibility, but
> why not just use .keys() and .items() instead?  Are these collections so big
> that making concrete lists in Python 2 will cause serious memory pressure?

Mm, I think at the time I was trying to make things work nicely with
2to3 or something.  You're right that it's unlikely to matter.  I've
replaced this with a commit that replaces all "for key in dict.keys()"
and "for key in dict.iterkeys()" with "for key in dict", per your above
comment, thereby reducing the need for six later on.

> 0011-Implement-rich
> 
> This looks fine.  If you wanted to, and you can support nothing less that
> Python 2.7 (not yet true for Debian), then you could define just __lt__ and
> __eq__ and let the @functools.total_ordering class decorator fill in the
> rest.  Just FYI.

I've added TODO comments for this.

> 0022-Be-much-more-careful
[...]
> It's a test, so this doesn't bother me too much, and also because while you
> could use contextlib.nested() in Python 2, that doesn't exist in Python 3.
> There, and in Python 2.7, the with-statement itself supports multiple context
> managers, so you could write:
> 
>     with open(filename, 'rb') as f1, open(filename, 'rb') as f2:
> 
> Unfortunately, that doesn't work in Python 2.6. :(

Indeed.  I looked at this at the time and decided it wasn't worth the
hassle for now; but I've added a TODO comment.

Here's an updated patch series, with a number of other minor changes
inspired by your commentary and my own experience of porting other
things to Python 3 since then.  I'd love a maintainer comment on this,
or if all else fails an indication that I should just NMU the lot. :-)
I'd really rather have maintainer review given the nature of the changes
though.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
[0001-Fix-test-warnings-with-python2.7-3.patch (text/x-diff, attachment)]
[0002-Avoid-various-old-syntactic-forms-which-are-no-longe.patch (text/x-diff, attachment)]
[0003-Use-Python-3-style-print-function.patch (text/x-diff, attachment)]
[0004-Use-a-list-comprehension-instead-of-map-which-return.patch (text/x-diff, attachment)]
[0005-Rely-on-default-mapping-iteration-rather-than-using-.patch (text/x-diff, attachment)]
[0006-Use-absolute-imports.patch (text/x-diff, attachment)]
[0007-Use-Python-3-style-print-function-in-examples.patch (text/x-diff, attachment)]
[0008-Use-key-in-dict-rather-than-obsolete-dict.has_key-ke.patch (text/x-diff, attachment)]
[0009-Use-open-rather-than-file-file-does-not-exist-in-Pyt.patch (text/x-diff, attachment)]
[0010-Use-sep.join-list-rather-than-string.join-list-sep.patch (text/x-diff, attachment)]
[0011-Implement-rich-comparison-methods-the-only-kind-avai.patch (text/x-diff, attachment)]
[0012-Use-assertTrue-and-assertEqual-rather-than-deprecate.patch (text/x-diff, attachment)]
[0013-Try-to-import-pickle-if-importing-cPickle-fails.-Pyt.patch (text/x-diff, attachment)]
[0014-Use-io.StringIO-if-StringIO.StringIO-is-absent-as-in.patch (text/x-diff, attachment)]
[0015-Use-collections.Mapping-collections.MutableMapping-i.patch (text/x-diff, attachment)]
[0016-Use-list-comprehensions-instead-of-map-where-a-list-.patch (text/x-diff, attachment)]
[0017-If-StandardError-does-not-exist-as-in-Python-3-inher.patch (text/x-diff, attachment)]
[0018-Use-six-to-paper-over-dict-iteration-differences-bet.patch (text/x-diff, attachment)]
[0019-Avoid-using-0L-since-Python-3-doesn-t-support-it-0-w.patch (text/x-diff, attachment)]
[0020-Cope-with-the-absence-of-a-file-class-in-Python-3.patch (text/x-diff, attachment)]
[0021-Python-3-renamed-raw_input-to-input.patch (text/x-diff, attachment)]
[0022-Be-much-more-careful-about-closing-files-in-a-timely.patch (text/x-diff, attachment)]
[0023-Use-next-iterator-rather-than-iterator.next.patch (text/x-diff, attachment)]
[0024-Use-string.ascii_letters-rather-than-the-deprecated-.patch (text/x-diff, attachment)]
[0025-Encode-Unicode-strings-before-passing-them-to-hashli.patch (text/x-diff, attachment)]
[0026-Fix-up-debian.changelog-for-string-handling-changes-.patch (text/x-diff, attachment)]
[0027-Only-define-DebPart.has_key-method-for-Python-2.patch (text/x-diff, attachment)]
[0028-Fix-up-debian.arfile-and-debian.debfile-for-string-h.patch (text/x-diff, attachment)]
[0029-Fix-up-most-of-debian.deb822-for-string-handling-cha.patch (text/x-diff, attachment)]
[0030-Fix-up-the-rest-of-debian.deb822-for-Python-3-string.patch (text/x-diff, attachment)]
[0031-Add-a-python3-debian-package.patch (text/x-diff, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 13 Jun 2012 17:33:03 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 13 Jun 2012 17:33:03 GMT) (full text, mbox, link).


Message #50 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@debian.org>
To: Barry Warsaw <barry@python.org>, 625509@bugs.debian.org
Subject: Re: Bug#625509: (no subject)
Date: Wed, 13 Jun 2012 18:30:24 +0100
On Wed, Jun 13, 2012 at 06:26:28PM +0100, Colin Watson wrote:
> Here's an updated patch series, with a number of other minor changes
> inspired by your commentary and my own experience of porting other
> things to Python 3 since then.  I'd love a maintainer comment on this,
> or if all else fails an indication that I should just NMU the lot. :-)
> I'd really rather have maintainer review given the nature of the changes
> though.

I've also updated the git branch here (with a non-fast-forward push,
sorry):

  http://anonscm.debian.org/gitweb/?p=users/cjwatson/python-debian.git;a=shortlog;h=refs/heads/python3

-- 
Colin Watson                                       [cjwatson@debian.org]




Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 13 Jun 2012 18:57:03 GMT) (full text, mbox, link).


Acknowledgement sent to Barry Warsaw <barry@python.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 13 Jun 2012 18:57:03 GMT) (full text, mbox, link).


Message #55 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Barry Warsaw <barry@python.org>
To: Colin Watson <cjwatson@ubuntu.com>
Cc: 625509@bugs.debian.org
Subject: Re: Bug#625509: (no subject)
Date: Wed, 13 Jun 2012 14:47:37 -0400
[Message part 1 (text/plain, inline)]
On Jun 13, 2012, at 06:26 PM, Colin Watson wrote:

>> Meta-question: do you think it makes sense to turn on `from __future__
>> import unicode_literals`?
>
>We've talked about this on a few occasions. :-)

I know.  I just can't seem to let this go. :)

>This is more or less the poster child for a case where I think
>unicode_literals is difficult.  There's a complex API which is quite
>sensitive to whether things are bytes or unicode in places, and often
>handles both.  The tests need to check whether both are handled.  It
>interacts with several other interfaces that prefer to work with bytes
>in Python 2 but Unicode strings in Python 3.
>
>In short, I did try, but I found it to be much more complicated to try
>to shift to unicode_literals than it was worth, and I really wasn't
>confident enough in absolute 100% test coverage to be certain I hadn't
>broken anything.

Agreed, thanks for the explanation!

Everything looks great; just one last suggestion.

diff --git a/lib/debian/deb822.py b/lib/debian/deb822.py
index 4c5b74e..7e8d0a6 100644
--- a/lib/debian/deb822.py
+++ b/lib/debian/deb822.py
> @@ -246,6 +246,8 @@ class Deb822Dict(object, UserDict.DictMixin):
>          # If we got here, everything matched
>          return True
>  
> +    __hash__ = None
> +

I think it would useful to include a comment for why this is here.  It's a
relatively obscure corner of the language, so it'll be helpful for the next
person reading the code.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 13 Jun 2012 19:21:06 GMT) (full text, mbox, link).


Acknowledgement sent to Stefano Zacchiroli <zack@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 13 Jun 2012 19:21:06 GMT) (full text, mbox, link).


Message #60 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Stefano Zacchiroli <zack@debian.org>
To: Colin Watson <cjwatson@ubuntu.com>, 625509@bugs.debian.org
Cc: Barry Warsaw <barry@python.org>
Subject: Re: Bug#625509: (no subject)
Date: Wed, 13 Jun 2012 21:17:20 +0200
[Message part 1 (text/plain, inline)]
On Wed, Jun 13, 2012 at 06:26:28PM +0100, Colin Watson wrote:
> Here's an updated patch series, with a number of other minor changes
> inspired by your commentary and my own experience of porting other
> things to Python 3 since then.  I'd love a maintainer comment on this,
> or if all else fails an indication that I should just NMU the lot. :-)
> I'd really rather have maintainer review given the nature of the changes
> though.

Hi Colin and Barry, thanks for your updates.  I'm a totally dormant
maintainer of python-debian and I don't feel yet qualified into
reviewing the patch, as I haven't yet done any serious development in
Python3. I've the impression that there is interest among python-debian
maintainers in having the python3 ports, but not enough active energy in
doing so before the freeze. I can't speak for all the co-maintainers,
but I'd personally love an NMU for this.  If others are against the
idea, please speak up (in the meantime I don't think a DELAYED NMU would
hurt anyone, as long as there's the willingness of reverting it if
someone speaks against it later on).

Thanks for your work,
Cheers.
-- 
Stefano Zacchiroli     zack@{upsilon.cc,pps.jussieu.fr,debian.org} . o .
Maître de conférences   ......   http://upsilon.cc/zack   ......   . . o
Debian Project Leader    .......   @zack on identi.ca   .......    o o o
« the first rule of tautology club is the first rule of tautology club »
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Mon, 18 Jun 2012 17:33:03 GMT) (full text, mbox, link).


Acknowledgement sent to Stuart Prescott <stuart+debian@nanonanonano.net>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Mon, 18 Jun 2012 17:33:03 GMT) (full text, mbox, link).


Message #65 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Stuart Prescott <stuart+debian@nanonanonano.net>
To: Colin Watson <cjwatson@ubuntu.com>
Cc: 625509@bugs.debian.org
Subject: python3-debian and python 3.3
Date: Mon, 18 Jun 2012 18:12:09 +0100
[Message part 1 (text/plain, inline)]
Hi Colin!

the patch for python3 support in python-debian works very nicely for python 
3.2. I was experimenting with python 3.3 (not in Debian and not even released 
yet!) because I was interested in lzma support and, with the newer python3, 
there looks like there will be test suite failures. 

The last of these is trivially fixable with

    def seekable(self):
        return True

the others look like a change in the way subprocess thinks about communicate() 
but I can't see anything in the 3.3 release notes that discusses this.

I don't know whether this fixing these for 3.2 in wheezy is important or not as 
it's not obvious to me whether these new failures are indicative of unfound 
bugs or changes in python itself.

cheers
Stuart

(PS I know that using a local install of /opt/bin/python3.3 with debian 
packaged modules (chardet, apt and six) in /usr/lib/python3/dist-packages/ is 
potentially asking for trouble, but I don't believe that this is necessarily 
the issue here)


$ for i in *.py; do PYTHONPATH=/usr/lib/python3/dist-packages/ 
/opt/bin/python3.3 $i; done
.................
----------------------------------------------------------------------
Ran 17 tests in 0.019s

OK
............E..............................EEEE..
======================================================================
ERROR: test_gpg_info (__main__.TestDeb822)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_deb822.py", line 392, in test_gpg_info
    result_from_str = deb822_from_str.get_gpg_info()
  File "../lib/debian/deb822.py", line 702, in get_gpg_info
    keyrings=keyrings)
  File "../lib/debian/deb822.py", line 826, in from_sequence
    out, err = p.communicate(inp)
  File "/opt/lib/python3.3/subprocess.py", line 906, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1513, in _communicate
    orig_timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1581, in 
_communicate_with_poll
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

======================================================================
ERROR: test_from_file (__main__.TestGpgInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_deb822.py", line 1028, in test_from_file
    gpg_info = deb822.GpgInfo.from_file(filename)
  File "../lib/debian/deb822.py", line 855, in from_file
    return cls.from_sequence(target_file, *args, **kwargs)
  File "../lib/debian/deb822.py", line 826, in from_sequence
    out, err = p.communicate(inp)
  File "/opt/lib/python3.3/subprocess.py", line 906, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1513, in _communicate
    orig_timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1581, in 
_communicate_with_poll
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

======================================================================
ERROR: test_from_sequence_newline_terminated (__main__.TestGpgInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_deb822.py", line 1007, in test_from_sequence_newline_terminated
    gpg_info = deb822.GpgInfo.from_sequence(sequence)
  File "../lib/debian/deb822.py", line 826, in from_sequence
    out, err = p.communicate(inp)
  File "/opt/lib/python3.3/subprocess.py", line 906, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1513, in _communicate
    orig_timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1581, in 
_communicate_with_poll
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

======================================================================
ERROR: test_from_sequence_no_newlines (__main__.TestGpgInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_deb822.py", line 1015, in test_from_sequence_no_newlines
    gpg_info = deb822.GpgInfo.from_sequence(sequence)
  File "../lib/debian/deb822.py", line 826, in from_sequence
    out, err = p.communicate(inp)
  File "/opt/lib/python3.3/subprocess.py", line 906, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1513, in _communicate
    orig_timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1581, in 
_communicate_with_poll
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

======================================================================
ERROR: test_from_sequence_string (__main__.TestGpgInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_deb822.py", line 999, in test_from_sequence_string
    gpg_info = deb822.GpgInfo.from_sequence(self.data)
  File "../lib/debian/deb822.py", line 826, in from_sequence
    out, err = p.communicate(inp)
  File "/opt/lib/python3.3/subprocess.py", line 906, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1513, in _communicate
    orig_timeout)
  File "/opt/lib/python3.3/subprocess.py", line 1581, in 
_communicate_with_poll
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

----------------------------------------------------------------------
Ran 49 tests in 0.395s

FAILED (errors=5)
.........E
======================================================================
ERROR: test_tar_bz2 (__main__.TestDebFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_debfile.py", line 145, in test_tar_bz2
    self.assertEqual(os.path.normpath(bz2_deb.data.tgz().getnames()[10]),
  File "../lib/debian/debfile.py", line 81, in tgz
    self.__tgz = tarfile.open(fileobj=self.__member, mode='r:bz2')
  File "/opt/lib/python3.3/tarfile.py", line 1584, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/opt/lib/python3.3/tarfile.py", line 1664, in bz2open
    t = cls.taropen(name, mode, fileobj, **kwargs)
  File "/opt/lib/python3.3/tarfile.py", line 1614, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/opt/lib/python3.3/tarfile.py", line 1488, in __init__
    self.firstmember = self.next()
  File "/opt/lib/python3.3/tarfile.py", line 2254, in next
    self.fileobj.seek(self.offset)
  File "/opt/lib/python3.3/bz2.py", line 361, in seek
    self._check_can_seek()
  File "/opt/lib/python3.3/bz2.py", line 171, in _check_can_seek
    if not self._fp.seekable():
AttributeError: 'ArMember' object has no attribute 'seekable'

----------------------------------------------------------------------
Ran 10 tests in 0.216s

FAILED (errors=1)
......
----------------------------------------------------------------------
Ran 6 tests in 0.005s

OK
...
----------------------------------------------------------------------
Ran 3 tests in 0.003s

OK






-- 
Stuart Prescott    --    www.nanonanonano.net
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Mon, 18 Jun 2012 17:48:06 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Mon, 18 Jun 2012 17:48:06 GMT) (full text, mbox, link).


Message #70 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@ubuntu.com>
To: Stuart Prescott <stuart+debian@nanonanonano.net>
Cc: 625509@bugs.debian.org
Subject: Re: python3-debian and python 3.3
Date: Mon, 18 Jun 2012 18:44:44 +0100
On Mon, Jun 18, 2012 at 06:12:09PM +0100, Stuart Prescott wrote:
> the patch for python3 support in python-debian works very nicely for python 
> 3.2. I was experimenting with python 3.3 (not in Debian and not even released 
> yet!) because I was interested in lzma support and, with the newer python3, 
> there looks like there will be test suite failures. 
> 
> The last of these is trivially fixable with
> 
>     def seekable(self):
>         return True

In arfile.ArMember, right?  Makes sense.  I guess that should be a 32nd
patch in this series, since it doesn't immediately fit into any of the
others.

> the others look like a change in the way subprocess thinks about communicate() 
> but I can't see anything in the 3.3 release notes that discusses this.

I think those other failures indicate that you're missing the
python3-apt patch from #656288.  Could you make sure of that?  It'd be
good to ensure that this all tests out cleanly with 3.3.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]




Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Mon, 18 Jun 2012 23:06:03 GMT) (full text, mbox, link).


Acknowledgement sent to Stuart Prescott <stuart+debian@nanonanonano.net>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Mon, 18 Jun 2012 23:06:03 GMT) (full text, mbox, link).


Message #75 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Stuart Prescott <stuart+debian@nanonanonano.net>
To: Colin Watson <cjwatson@ubuntu.com>
Cc: 625509@bugs.debian.org
Subject: Re: python3-debian and python 3.3
Date: Tue, 19 Jun 2012 00:02:10 +0100
[Message part 1 (text/plain, inline)]
Hi Colin,

apologies for not being more exact for you in the previous email -- hopefully 
this makes up for it!

> >     def seekable(self):
> >         return True
> 
> In arfile.ArMember, right?  

correct -- patch attached if that helps

> > the others look like a change in the way subprocess thinks about
> > communicate() but I can't see anything in the 3.3 release notes that
> > discusses this.
> 
> I think those other failures indicate that you're missing the
> python3-apt patch from #656288.  Could you make sure of that?  It'd be
> good to ensure that this all tests out cleanly with 3.3.

On double checking, I realise that I do not have python3-apt installed in that 
chroot and that python-debian is falling back to its internal parser. I should 
also reiterate that the test suite passed without issue with sid's python3 
(3.2.3~rc2-1) package; the test suite failures are all in the communication 
with gpg not apt. 

The root of all the failures is deb822.GpgInfo.from_sequence() and its 
interaction with subprocess. While the changes summary for 3.3 doesn't mention 
anything about subprocess, there's a 1000 line diff between 3.2.3 and 3.3.0a4. 
The key difference is that the "universal_newlines" behaviour flag now influences 
the data that is sent to stdin of the subprocess as well as the stdout/stderr 
coming back. This means that the input data given to subprocess.communicate() 
must be of the appropriate type:

	«The type of input must be bytes or, if universal_newlines was True, a 
string.»

http://docs.python.org/dev/library/subprocess.html#subprocess.Popen.communicate

My reading of this is that for python3.3, setting universal_newlines=True and 
sending bytes is wrong. The attached patch turns universal_newlines off and 
sends bytes in both directions. The alternative would be to leave 
universal_newlines=True and fix the treatment of "inp" before passing it to 
p.communicate(). I have no feeling either way other than the changes I made 
looked less invasive.

(BTW if GpgInfo._get_full_string() is going to return bytes, perhaps the 
method name and docstring should change -- misleading method names make bytes 
vs strings even harder to track down than they otherwise should be.)

Application of the two attached patches along with your patch stack allows the 
test suite to pass with both python3.2 and python3.3a4.

cheers
Stuart

-- 
Stuart Prescott    --    www.nanonanonano.net
[armember-seekable.patch (text/x-patch, attachment)]
[subprocess-encoding.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Tue, 19 Jun 2012 00:00:37 GMT) (full text, mbox, link).


Acknowledgement sent to Stuart Prescott <stuart+debian@nanonanonano.net>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Tue, 19 Jun 2012 00:00:37 GMT) (full text, mbox, link).


Message #80 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Stuart Prescott <stuart+debian@nanonanonano.net>
To: Colin Watson <cjwatson@ubuntu.com>
Cc: 625509@bugs.debian.org
Subject: Re: python3-debian and python 3.3
Date: Tue, 19 Jun 2012 00:59:52 +0100
[Message part 1 (text/plain, inline)]
Of course, maintaining compatibility with python2 would be better... so the 
attached is a nicer plan for dealing with the encoding to subprocess.

cheers
Stuart

-- 
Stuart Prescott    --    www.nanonanonano.net
[subprocess-encoding-py2compat.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>:
Bug#625509; Package python-debian. (Wed, 22 Aug 2012 17:15:03 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>. (Wed, 22 Aug 2012 17:15:03 GMT) (full text, mbox, link).


Message #85 received at 625509@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@ubuntu.com>
To: Stuart Prescott <stuart+debian@nanonanonano.net>
Cc: 625509@bugs.debian.org
Subject: Re: python3-debian and python 3.3
Date: Wed, 22 Aug 2012 18:10:43 +0100
[Message part 1 (text/plain, inline)]
On Tue, Jun 19, 2012 at 12:02:10AM +0100, Stuart Prescott wrote:
> The root of all the failures is deb822.GpgInfo.from_sequence() and its 
> interaction with subprocess.
[...]

Thanks for this analysis.  I initially felt that it would be better to
make things work with universal_newlines=True here, but on reflection I
think you're right; we don't want to introduce any signature-checking
failures due to encoding and decoding.


Months since the last maintainer response to this bug, and bearing in
mind Stefano's suggestion of a DELAYED NMU - although it's more than I
would normally be comfortable NMUing for - I have uploaded an NMU to
DELAYED/3 with all these changes.  I've attached the new patch stack,
including your comments, one from Barry that I'd missed, and several
adjustments to cope with failures in sbuild (mostly test suite trouble
with LC_ALL=C, and some doc-debtags fixes).
http://anonscm.debian.org/gitweb/?p=users/cjwatson/python-debian.git;a=shortlog;h=refs/heads/python3
is up-to-date and will no longer be rebased up to the 0.1.21+nmu1 tag,
so the maintainers can safely pull from this if they want to.

Please let me know ASAP if there are any problems with this - I'll be
off on holiday from Friday.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
[0001-Fix-test-warnings-with-python2.7-3.patch (text/x-diff, attachment)]
[0002-Avoid-various-old-syntactic-forms-which-are-no-longe.patch (text/x-diff, attachment)]
[0003-Use-Python-3-style-print-function.patch (text/x-diff, attachment)]
[0004-Use-a-list-comprehension-instead-of-map-which-return.patch (text/x-diff, attachment)]
[0005-Rely-on-default-mapping-iteration-rather-than-using-.patch (text/x-diff, attachment)]
[0006-Use-absolute-imports.patch (text/x-diff, attachment)]
[0007-Use-Python-3-style-print-function-in-examples.patch (text/x-diff, attachment)]
[0008-Use-key-in-dict-rather-than-obsolete-dict.has_key-ke.patch (text/x-diff, attachment)]
[0009-Use-open-rather-than-file-file-does-not-exist-in-Pyt.patch (text/x-diff, attachment)]
[0010-Use-sep.join-list-rather-than-string.join-list-sep.patch (text/x-diff, attachment)]
[0011-Implement-rich-comparison-methods-the-only-kind-avai.patch (text/x-diff, attachment)]
[0012-Use-assertTrue-and-assertEqual-rather-than-deprecate.patch (text/x-diff, attachment)]
[0013-Try-to-import-pickle-if-importing-cPickle-fails.-Pyt.patch (text/x-diff, attachment)]
[0014-Use-io.StringIO-if-StringIO.StringIO-is-absent-as-in.patch (text/x-diff, attachment)]
[0015-Use-collections.Mapping-collections.MutableMapping-i.patch (text/x-diff, attachment)]
[0016-Use-list-comprehensions-instead-of-map-where-a-list-.patch (text/x-diff, attachment)]
[0017-If-StandardError-does-not-exist-as-in-Python-3-inher.patch (text/x-diff, attachment)]
[0018-Use-six-to-paper-over-dict-iteration-differences-bet.patch (text/x-diff, attachment)]
[0019-Avoid-using-0L-since-Python-3-doesn-t-support-it-0-w.patch (text/x-diff, attachment)]
[0020-Cope-with-the-absence-of-a-file-class-in-Python-3.patch (text/x-diff, attachment)]
[0021-Python-3-renamed-raw_input-to-input.patch (text/x-diff, attachment)]
[0022-Be-much-more-careful-about-closing-files-in-a-timely.patch (text/x-diff, attachment)]
[0023-Use-next-iterator-rather-than-iterator.next.patch (text/x-diff, attachment)]
[0024-Use-string.ascii_letters-rather-than-the-deprecated-.patch (text/x-diff, attachment)]
[0025-Encode-Unicode-strings-before-passing-them-to-hashli.patch (text/x-diff, attachment)]
[0026-Fix-up-debian.changelog-for-string-handling-changes-.patch (text/x-diff, attachment)]
[0027-Only-define-DebPart.has_key-method-for-Python-2.patch (text/x-diff, attachment)]
[0028-Fix-up-debian.arfile-and-debian.debfile-for-string-h.patch (text/x-diff, attachment)]
[0029-Fix-up-most-of-debian.deb822-for-string-handling-cha.patch (text/x-diff, attachment)]
[0030-Fix-up-the-rest-of-debian.deb822-for-Python-3-string.patch (text/x-diff, attachment)]
[0031-Add-seekable-method-to-debian.arfile.ArMember.patch (text/x-diff, attachment)]
[0032-Make-deb822.GpgInfo.from_sequence-compatible-with-Py.patch (text/x-diff, attachment)]
[0033-Add-a-python3-debian-package.patch (text/x-diff, attachment)]
[0034-releasing-version-0.1.21-nmu1.patch (text/x-diff, attachment)]

Added tag(s) pending. Request was from Anibal Monsalve Salazar <anibal@debian.org> to control@bugs.debian.org. (Sat, 25 Aug 2012 20:06:04 GMT) (full text, mbox, link).


Reply sent to Colin Watson <cjwatson@debian.org>:
You have taken responsibility. (Fri, 31 Aug 2012 19:03:13 GMT) (full text, mbox, link).


Notification sent to Tshepang Lekhonkhobe <tshepang@gmail.com>:
Bug acknowledged by developer. (Fri, 31 Aug 2012 19:03:13 GMT) (full text, mbox, link).


Message #92 received at 625509-close@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@debian.org>
To: 625509-close@bugs.debian.org
Subject: Bug#625509: fixed in python-debian 0.1.21+nmu1
Date: Fri, 31 Aug 2012 19:00:15 +0000
Source: python-debian
Source-Version: 0.1.21+nmu1

We believe that the bug you reported is fixed in the latest version of
python-debian, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 625509@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Colin Watson <cjwatson@debian.org> (supplier of updated python-debian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 22 Aug 2012 16:27:05 +0100
Source: python-debian
Binary: python-debian python3-debian
Architecture: source all
Version: 0.1.21+nmu1
Distribution: unstable
Urgency: low
Maintainer: Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>
Changed-By: Colin Watson <cjwatson@debian.org>
Description: 
 python-debian - Python modules to work with Debian-related data formats
 python3-debian - Python 3 modules to work with Debian-related data formats
Closes: 625509
Changes: 
 python-debian (0.1.21+nmu1) unstable; urgency=low
 .
   * Non-maintainer upload.
   * Port to Python 3. (Closes: #625509)
Checksums-Sha1: 
 fca8babedc1e22ec0f16909079126f9246e985a0 2130 python-debian_0.1.21+nmu1.dsc
 5430d80f6d7f8193100687eeb265fecd0052c034 188213 python-debian_0.1.21+nmu1.tar.gz
 27c79cb24feabbcf3b5d7a2288f60a6a43325f08 64014 python-debian_0.1.21+nmu1_all.deb
 dce1316d57906edcfde40fd10ebd9aaf21d9f310 46264 python3-debian_0.1.21+nmu1_all.deb
Checksums-Sha256: 
 c33ff812363b5bae7f8bb8f53334a4a3edb4e3e5c666f6b7e3c513b98ad35dd6 2130 python-debian_0.1.21+nmu1.dsc
 4da2d0ce92b3714fe0e808fcc5086ede6f250840fb62f95f3e9f2f9e718ddd78 188213 python-debian_0.1.21+nmu1.tar.gz
 02fcb6f3461bcb8bc62d11950d6b0293c353378f42dbc392a821650839c0102a 64014 python-debian_0.1.21+nmu1_all.deb
 3e5c32fc699766342a387645cd7808ba2a48d250ba02b1432b5d6c1421967374 46264 python3-debian_0.1.21+nmu1_all.deb
Files: 
 a212ee74a15f039c756c871edc6ab270 2130 python optional python-debian_0.1.21+nmu1.dsc
 171c323528a3f9f5158bdf4d53199ee4 188213 python optional python-debian_0.1.21+nmu1.tar.gz
 2008417382d8ff5183fb03407fb94cc4 64014 python optional python-debian_0.1.21+nmu1_all.deb
 2aae4f133da0890885039e60dc218a41 46264 python optional python3-debian_0.1.21+nmu1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Colin Watson <cjwatson@debian.org> -- Debian developer

iQIVAwUBUDUOUzk1h9l9hlALAQhD1RAAnajuoYu65oHCDoN4pu/khpXYduq2Lk3k
zF5c1JPuUh9CWNIbgJQtaTXXQlwTt8a3jM95Ilx3SM0z5GFSljyRta9ynD+2vcMz
cKjcrDi/rui8Ossg7joKFJR9GQTdGRG/d3HvieOXIpakZG+/sMknW3DLZd5b70Ll
ac/tFb+TtCo9QDbD9JTKs0E/JJXU5aoIo/P3t9EFDHNYZBla1nerwJvNRHixqoDT
ZaITv/XEpOfnk0htuKPGSe71mUlWtq0kRPRULeIBpjBN0l1itBzq9isCpG2g5RvI
0V/0JEdsZKVBJiBUwnlP7rdwCVuW/UlWdIrLO/RIoYvG1wO0Bczb8+jGc0F8OCEs
/04hDKDk9IJO2zokNYrpa53QjfMdH/7WWyTIKP3hT7Nzo5zuJ0E2TWOogIpg+PQb
7v2Jm98AgRN53Fhtix3QBu2dgNfHUzBwek7VkDox3WpUYNz0obOWjKINOCKwzi1j
3Qc4HLmwKjMTBEoLlTPOhq5HWc4EJs+zIaxSVsAvA0OrpLGLyKfD78o29eQesFPr
OWX1gV5gqUgSIqHaTDcjPUCftcQ0kvX6TYyqa3Qn8WhfaWSIFSKEJcRIrwRjjEft
VugHAfODvJyb8WhHYUif2J5oGeD3/fS4VKX5jzMKjBclSNfmeI1AzkaVba2gZfi6
Mppfmv1N4vQ=
=aMNy
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 03 Jun 2013 07:36:37 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Jan 13 11:47:26 2018; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.