[Distutils] distribute 0.6.10 and convert_2to3_doctests

Barry Warsaw barry at python.org
Thu Jan 7 00:17:18 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I have a Python package called 'munepy' <https://launchpad.net/munepy> which
provides yet another flavor of enums.  I'm working on the code for various
reasons and I thought I'd take the opportunity to learn how to support both
Python 2 and 3 from the same code base.

I've updated the code so that it supports Python 2.6 at a minimum, and made it
'python -3' clean.  I've switched it from using setuptools to using
distribute.  I was looking at this page:

    http://packages.python.org/distribute/python3.html

and it seems very cool that distribute can help make my life easier by
allowing me to support both Python 2 and 3 from the same code base.  I set
use_2to3=True in my setup.py and indeed

    % python3 setup.py test

(On Ubuntu 9.10) runs 2to3 over my .py files.  However, my doctests are in
separate .txt files and I cannot seem to get the right incantation for
convert_2to3_doctests.

In the root of my source directory, my doctest lives at
munepy/docs/README.txt, so I put this in my setup.py:

    ...
    use_2to3 = True,
    convert_2to3_doctests = [
        'munepy/docs/README.txt',
        ],
    ...

but I never see that the README.txt is ever 'fixed'.  Indeed, the test fails
because of a syntax error when the doctest tries to print something using
Python 2 syntax.  I'm clearly not using this setup argument correctly, but I
can't tell where I'm going wrong.

How do you use convert_2to3_doctests?

TIA,
- -Barry
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCAAGBQJLRRn+AAoJEBJutWOnSwa/U78P/06neAOc4cbeaKty7OX1AvUo
9QKwNrmH5U/spbvvThPKCl+XXPDJdD4K40zCSaq98vGXdjxIgBapCvQi3/lUBtKM
M5CBVJvsbJnaeAZUjUS2EZ+CLXkMAmWA/8znmo3xsGJ+8+F77Wb9iTwobQpQqmWJ
z43BLaiT62fzWqC4vsBjG6JMF0VZZZ51IRrzD48lasYItHa4cUQa/brC8jwGUhE4
060zo+cof5UvbMRNP0OU69p0M5PztOtszLKHaOhD8EsAF8r1PWtOT2oGpij8jLst
GBp82J+JOlgWiEFSmVLaSOl/0D0193ut+PtHLCLDOJ9sVXgIKv4RvWMip1/0W1bB
btneAIUJ/CFxCJuBcadkGtwS9geuaM+ma2rlYOpwTBncBEZx9XVPOxnEuCyUSrSo
03QXZ6xxOKf1Xepg3AjDD2KSxrAZHoG4aLVGdxqFyAebpC9hiKYRrLswe5mg/ycj
eo5lpKjGplL5Md0O9ZgJmqk0UH4CVZy7Imrv8BMQcMCZLkbs42FnMXtXVWEVQ9qm
iA3T54Yi5dOZB56JjnkftyS15in8W5OiV1X78WtblQ7/f5oR1UXq72mZU3k+3nrX
kxWfzsHAo1v34+WHUagmYZqLYtm/zFT+zHwoyzzMcWpJSTH8WIOud9IuSkg5gA3S
B2iMITFAZnXKzB644gIP
=GqOL
-----END PGP SIGNATURE-----


More information about the Distutils-SIG mailing list