README.py3k 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. =================
  2. PYTHON 3 SUPPORT
  3. =================
  4. Python 3 support in Mako is provided by the Python 2to3 script.
  5. Installing Distribute
  6. ---------------------
  7. Distribute should be installed with the Python3 installation. The
  8. distribute bootloader is included.
  9. Running as a user with permission to modify the Python distribution,
  10. install Distribute:
  11. python3 distribute_setup.py
  12. Installing Mako in Python 3
  13. ---------------------------------
  14. Once Distribute is installed, Mako can be installed directly.
  15. The 2to3 process will kick in which takes several minutes:
  16. python3 setup.py install
  17. Converting Tests, Examples, Source to Python 3
  18. ----------------------------------------------
  19. To convert all files in the source distribution, run
  20. the 2to3 script:
  21. 2to3 -w mako test
  22. If using 3.1's 2to3 tool, the --no-diffs flag might help
  23. with unicode issues:
  24. 2to3-3.1 -w --no-diffs mako test
  25. The above will rewrite all files in-place in Python 3 format.
  26. Running Tests
  27. -------------
  28. To run the unit tests, ensure Distribute is installed as above,
  29. and also that at least the ./mako/ and ./test/ directories have been converted
  30. to Python 3 using the source tool above. A Python 3 version of Nose
  31. can be acquired from Bitbucket using Mercurial:
  32. hg clone http://bitbucket.org/jpellerin/nose3/
  33. cd nose3
  34. python3 setup.py install
  35. The tests can then be run using the "nosetests3" script installed
  36. by the above (python3 setup.py test doesn't seem to be working with
  37. nose3).