-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Convert syntax to meet py3 standards #871
Conversation
I haven't been using six for very long, so I haven't run into any issues. However, I did take a brief look at
This is definitely true.
I did take at
I bring this up here because six or a similar library is needed to replace |
six is about a thousand lines of code that takes signficant time (several milliseconds) to import. polyglot is a hundred lines of code by contrast. But, my main issue with six is that in the past it has made backwards incompatible changes that broke working code for me. For something that requires so little code to write, and that is used so widely, I prefer not adding an eternal dependency. That way we are in control of the code. As for removing it when dropping py2 support, that is esaily done with some help from pyflakes and a little cleanup script. It also has the advantage that it is both faster (avoid extra dict lookup) and more pleasant to use (less to type). However, I dont want you to have to do extra work for my preferences. So feel free to use six in your PRs that use the modernize library. I will take care of migrating them to polyglot. |
Note that there is going to be a calibre release in a couple of days, I will review and merge this PR after that. |
Sounds good to me. Ping me once you make the release, and I'll be happy to rebase onto current master. |
The release has been made |
Command used: futurize --no-diffs -f libfuturize.fixes.fix_print_with_import -f lib2to3.fixes.fix_throw -f lib2to3.fixes.fix_numliterals -f lib2to3.fixes.fix_except -f lib2to3.fixes.fix_exec -f lib2to3.fixes.fix_raise -f lib2to3.fixes.fix_tuple_params -f lib2to3.fixes.fix_ne -j20 -w -n setup recipes src manual setup.py recipes/*.recipe And manual adjustments of print((...)) -> print(...)
New-style rasies need to be redone in a py2-friendly way, and the redudant imports are redudnant and can safely be removed
I have merged, with some minor corrections and removing the six module. Thanks. |
As per roadmap above, I have ported the setup package to the extent that setup.py build now runs. Now it is over to you to port the C extensions. Please send a separate PR for each that I will review and merge. |
Oh and just FYI you can build individual C extension using ./setup.py build --only see ./setup.py build --help for details |
This has just a few easy-to-fix syntax error in python 3:
I also patched
python3.7/compileall.py:137
to bein order to test the syntax of the
.recipe
filesThis patch was tested following this process:
python ./setup.py bootstrap --clean-all
SIP_DIR=/usr/share/sip python ./setup.py bootstrap
python ./setup.py test
python3 -m compileall src build recipes/**/*.recipe manual -q