[pycrypto] Once again: Python3 with PyCrypto

Arfrever Frehtes Taifersar Arahesis arfrever.fta at gmail.com
Thu Dec 23 20:26:30 CST 2010


2010-12-24 02:20:28 Thorsten Behrens napisał(a):
> I've looked into this some more. There are two basic approaches:
> 
> a) Create .py code that will work in Python 2.x and 3.x. Code will 
> become uglier; for example try except blocks have to be used for 
> imports. One can catch a glimpse here: 
> http://pydev.blogspot.com/2008/11/making-code-work-in-python-2-and-3.html
> 
> b) Leave .py code to be written for Python 2.x, with some cleanup 
> applied to redo constructs that cannot be converted by 2to3. When ready 
> to release, run 2to3 on the source tree, and release two versions: One 
> for Python 2.x, one for Python 3.x.

setup.py can automatically run 2to3:

try:
  # Python 3
  from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
  # Python 2
  from distutils.command.build_py import build_py

-- 
Arfrever Frehtes Taifersar Arahesis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.dlitz.net/pipermail/pycrypto/attachments/20101224/710c88fd/attachment.pgp 


More information about the pycrypto mailing list