This PR modifies pynailgun to work under both Python 2.7 and Python 3.5/3.6.
Here are some of the changes necessary to be compatible with both Python 2 and 3.
Being explicit about when we encode and decode between str and bytes
Changing imports and import aliasing based on version
Changing CHUNKTYPEs to use byte literals
Not using raw string literals (ur'text')
Wrapping calls to .fileno() in a try
Additionally it changes the TravisCI build script to test multiple Python versions explicitly.
You can see my changes passes in TravisCI here: https://travis-ci.org/valencik/nailgun
Perhaps of note, I have built and tested these modifications in a fork of https://github.com/scalacenter/bloop and things worked wonders under both Python versions.
Please do let me know if anything else is needed to get this merged.
I am happy to help.
This PR modifies
pynailgun
to work under both Python 2.7 and Python 3.5/3.6.Here are some of the changes necessary to be compatible with both Python 2 and 3.
str
andbytes
ur'text'
).fileno()
in atry
Additionally it changes the TravisCI build script to test multiple Python versions explicitly. You can see my changes passes in TravisCI here: https://travis-ci.org/valencik/nailgun
Perhaps of note, I have built and tested these modifications in a fork of https://github.com/scalacenter/bloop and things worked wonders under both Python versions. Please do let me know if anything else is needed to get this merged. I am happy to help.
(https://github.com/facebook/nailgun/issues/127)