meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

Fix/py3k #116

Closed isislovecruft closed 9 years ago

isislovecruft commented 9 years ago

My fix/py3k branch contains some initial changes for maintaining simultaneous Python 2 and Python 3 compatibility.

Running make test passes for both python2.7 and python3.4.

However, Python3.4 with Twisted==15.2.0 is still not working, mostly due to txtorcon's pervasive use of the Twisted Endpoints API, not all of which has been ported to py3k yet (specifically, t.i.e.UNIXServerEndpoint and t.i.e.UNIXClientEndpoint, which currently seems to be the largest barrier to running txtorcon with Python 3).

The use of:

from __future__ import unicode_literals

was messing up the use of twisted.internet.protocols and also appeared to break setuptools in many ways, so I removed the line (which I had originally added to all txtorcon's files) from some of the files. The rest might need to be removed? The tests pass, at least…


One other thing to note is that the version of ipaddr that txtorcon pins uses a deprecated syntax for designating longs, i.e.: 0L. To work around this, I had to basically do:

curl -o ipaddr-2.1.11.tar.gz https://pypi.python.org/packages/source/i/ipaddr/ipaddr-2.1.11.tar.gz#md5=f2c7852f95862715f92e7d089dc3f2cf
md5sum ipaddr-2.1.11.tar.gz
tar xvf ipaddr-2.1.11.tar.gz && cd ipaddr-2.1.11

and replace the 0L with 0. (I think this was all I had to do.)

coveralls commented 9 years ago

Coverage Status

Coverage decreased (-0.24%) to 99.63% when pulling 6a909b3e804b6865e357eb7d8b58d6fed3c8d33c on isislovecruft:fix/py3k into 9523319cecbc1d0aa8fdb4d6874f0debc22d0432 on meejah:master.

meejah commented 9 years ago

Just to follow-up on this, I haven't taken a look yet until there's a Twisted that supports endpoints. This should be coming "very soon" as I believe hawkowl has ported the unix-sockets stuff which was (one of?) the last blockers on Py3 endpoints support.

meejah commented 9 years ago

I took out the FIXMEs and put serverFromString back in as Twisted 15.4.0 appears to work fine (as well as all the other Tox environments).

PyPy 2.6+ doesn't appear to work due to some setuptools somethingsomething I haven't figured out yet but that's unrelated to this branch.

Thanks for the PR!