Brett Cannon | 17 May 2012 17:14
Favicon
Gravatar

Re: Python 2/3 compatible distutils installation?



On Wed, May 16, 2012 at 10:12 PM, Barry Warsaw <barry-+ZN9ApsXKcEdnm+yROfE0A@public.gmane.org> wrote:
On May 16, 2012, at 06:38 PM, Chris Jerdonek wrote:

>Have you thought about storing the two files with an extension other
>than .py?  You could argue that from Python 3's perspective, for
>example, the compat2 file isn't really a Python file.  You could write
>your setup script so that it copies the correct file into place at
>compat.py before calling setup(), and then cleans up afterwards.  This
>way, the distutils code could proceed normally.  Also, you wouldn't
>need special version-checking code in the actual package because then
>both versions would be importing compat when installed.

It's an interesting idea, thanks.  I'll point upstream at this thread and see
if they want to explore it more or if they want to go in the direction of
using six (which would eliminate the need to use the _compatX.py files in this
particular case).

Your other option is to keep the code in string literals and then do the proper compile/exec step just like import does. Basically do you want the hack in distutils or the modules themselves. 
_______________________________________________
Python-porting mailing list
Python-porting@...
http://mail.python.org/mailman/listinfo/python-porting

Gmane