-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 compatibility #7
Conversation
- Adds a tox.ini file for running the tests in both python 2 and python 3. - Update raised ValueError to something with the same __repr__ in both python 2 and python 3. This fixes the doctests. - Update trove classifiers to indicate this package is python 2 and python 3 compatible.
scripts/bootstrap.py
Outdated
@@ -69,12 +69,12 @@ | |||
except ImportError: | |||
ez = {} | |||
if USE_DISTRIBUTE: | |||
exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py' | |||
).read() in ez | |||
exec(urllib2.urlopen('http://python-distribute.org/distribute_setup.py' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fixes were added automatically by the futurize
command. The script still isn't quite python 3 compatible, but seems to be broken anyway, since the link 404s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has upstream bootstrap been updated for python 3 as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to have been updated, yes: https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py I don't understand the build scripts well enough to test them, so I've reverted my changes to the scripts
directory in 27ce639.
My primary purpose in this PR was get the test suite to pass on Python 3 and update the trove classifiers so that pathtools
no longer appears as "not ready" on the wall of python 3 readiness. The build scripts can stay on python 2 until its end of life.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be great to run the tests on Travis CI.
@lucaswiman Why have you reverted changes in scripts/*.py? Python 2.7 supports these calls natively. |
@hugovk It's a separate task to run tests on Travis CI. I'd prefer to be sure that this task is complete and this PR doesn't add new features. |
As I said in my comment above, the scripts still aren't python 3 compatible after those changes, but I don't understand scripts well enough to test them on python 3. They're not part of the sdist package, so upgrading them isn't as big a priority. I can investigate making additional changes if you want. However, I do not want to devote more effort unless there's some chance it will get merged and deployed to pypi. This PR has been open for 18 months. Are you in favor of deploying this change to pypi once your review comments are addressed? |
@@ -73,7 +73,7 @@ def walk(path, topdown=topdown, followlinks=followlinks): | |||
try: | |||
yield next(os.walk(path, topdown=topdown, followlinks=followlinks)) | |||
except NameError: | |||
yield os.walk(path, topdown=topdown, followlinks=followlinks).next() #IGNORE:E1101 | |||
yield next(os.walk(path, topdown=topdown, followlinks=followlinks)) #IGNORE:E1101 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is now exactly the same line as inside the "try". I think this was here for Python 2.6 compatibility. Instead of this change, the except clause should simply be removed.
With Python2 EOL approaching I am curious if this effort can be revived |
This could be done in a few steps. It's not required to do it all at once. For bootstrap on python3 I'd recommend to install the most recent |
I am not planning any further work on this. Please open a new PR if anyone wants to take this on. |
@lucaswiman Thank you for your efforts |
@gorakhargosh cc @nickjacobson Supercedes #6. Fixes #4.
ValueError
to something with the same__repr__
in both python 2 and python 3. This fixes the doctests.Other than some of the build scripts (which I couldn't get working even on python 2), everything was Python 3 compatible, except that the doctests had an annoying incompatibility where the exception had a different repr between python 2 and python 3:
I updated the error so it includes a
list
of conflicting patterns. That has the same repr on python 2 and python 3.