Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #10013 > unrolled thread

Packaging with 2to3

Started byOle Streicher <olebole@debian.org>
First post2017-12-18 22:50 +0100
Last post2017-12-19 13:40 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.debian.maint.python


Contents

  Packaging with 2to3 Ole Streicher <olebole@debian.org> - 2017-12-18 22:50 +0100
    Re: Packaging with 2to3 Thomas Goirand <zigo@debian.org> - 2017-12-18 23:20 +0100
    Re: Packaging with 2to3 Michael Hudson-Doyle <michael.hudson@canonical.com> - 2017-12-19 01:50 +0100
      Re: Packaging with 2to3 Piotr Ożarowski <piotr@debian.org> - 2017-12-19 13:40 +0100

#10013 — Packaging with 2to3

FromOle Streicher <olebole@debian.org>
Date2017-12-18 22:50 +0100
SubjectPackaging with 2to3
Message-ID<uYbsl-5Sc-5@gated-at.bofh.it>
Hi,

I want to create a package (pyraf, #711038) for both Python2 and
Python3. While the package itself is still not Python 3 compatible,
upstream says that running through 2to3 will make it; however the
resulting code is not Python 2 compatible anymore.

Is there a way to instruct pybuild to run the Python 3 code through
2to3?

Best regards

Ole

[toc] | [next] | [standalone]


#10014

FromThomas Goirand <zigo@debian.org>
Date2017-12-18 23:20 +0100
Message-ID<uYbVn-6iv-3@gated-at.bofh.it>
In reply to#10013
On 12/18/2017 10:26 PM, Ole Streicher wrote:
> Hi,
> 
> I want to create a package (pyraf, #711038) for both Python2 and
> Python3. While the package itself is still not Python 3 compatible,
> upstream says that running through 2to3 will make it; however the
> resulting code is not Python 2 compatible anymore.
> 
> Is there a way to instruct pybuild to run the Python 3 code through
> 2to3?
> 
> Best regards
> 
> Ole

Instead, I'd advise to use sixer (available in Debian
Stretch/Buster/Sid) to produce a patch that you can submit upstream, or
embed in your package. Sixer will patch the code in a way so that it
works with both Python 2 and 3.

Note that it wont do *all* for you, like you'll have to convert print
statements into function calls manually, but it does a big chunk, which
is quite helpful.

I hope that helps,
Cheers,

Thomas Goirand (zigo)

[toc] | [prev] | [next] | [standalone]


#10015

FromMichael Hudson-Doyle <michael.hudson@canonical.com>
Date2017-12-19 01:50 +0100
Message-ID<uYegx-7Kn-3@gated-at.bofh.it>
In reply to#10013

[Multipart message — attachments visible in raw view] — view raw

On 19 December 2017 at 10:26, Ole Streicher <olebole@debian.org> wrote:

> Hi,
>
> I want to create a package (pyraf, #711038) for both Python2 and
> Python3. While the package itself is still not Python 3 compatible,
> upstream says that running through 2to3 will make it; however the
> resulting code is not Python 2 compatible anymore.
>
> Is there a way to instruct pybuild to run the Python 3 code through
> 2to3?


python-urwid does this, by passing use_2to3 to the distutils setup()
function, I guess you could patch it to do the same.

Cheers,
mwh

[toc] | [prev] | [next] | [standalone]


#10016

FromPiotr Ożarowski <piotr@debian.org>
Date2017-12-19 13:40 +0100
Message-ID<uYplE-6AP-5@gated-at.bofh.it>
In reply to#10015
[Michael Hudson-Doyle, 2017-12-19]
> > I want to create a package (pyraf, #711038) for both Python2 and
> > Python3. While the package itself is still not Python 3 compatible,
> > upstream says that running through 2to3 will make it; however the
> > resulting code is not Python 2 compatible anymore.
> >
> > Is there a way to instruct pybuild to run the Python 3 code through
> > 2to3?
> 
> python-urwid does this, by passing use_2to3 to the distutils setup()
> function, I guess you could patch it to do the same.

if you need 2to3 for tests as well, see:
https://wiki.debian.org/Python/Pybuild#line-148
-- 
GPG: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.maint.python


csiph-web