[Python-porting] Installing different files on Python 2/3

Guido van Rossum guido at python.org
Thu Jul 17 17:45:19 CEST 2014


The Py2 version can just call exec(code, gns, lns). It is Py2 syntax too!
On Jul 17, 2014 12:06 AM, "Dirkjan Ochtman" <dirkjan at ochtman.nl> wrote:

> After porting CouchDB-Python and trying out an install on a system
> that has both, I ran into a minor issue. I searched around a bit, but
> didn't find any promising solution.
>
> With CouchDB-Python, I chose a single-source solution, with a util
> module that imports a util2 or util3 module based on the Python
> version at run time. One of the problems solved in these files is the
> exec incompatibility. util2 has this version of the function:
>
> def pyexec(code, gns, lns):
>     exec code in gns, lns
>
> Whereas util3 has this version:
>
> pyexec = exec
>
> However, on installation, all modules are byte-compiled, and both of
> these cause errors at the syntax level in the version of Python
> they're not intended for. I'm using a MANIFEST.in to list out the
> SOURCES.txt; is there any nice way of manipulating that data dependent
> on the python version?
>
> Cheers,
>
> Dirkjan
> _______________________________________________
> Python-porting mailing list
> Python-porting at python.org
> https://mail.python.org/mailman/listinfo/python-porting
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20140717/e67bbb86/attachment.html>


More information about the Python-porting mailing list