-
Notifications
You must be signed in to change notification settings - Fork 3.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
Python 3 compatibility: Use print()
function
#5610
Conversation
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.
Thanks! Overall this looks good. I just have the one question in a comment above, that I'm not sure about.
@@ -1,3 +1,4 @@ | |||
from __future__ import print_function |
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.
i'm not sure we should update external python files that have an upstream. in this file's case, we never use it, it's just part of bullet and we included it all. so i guess it would harmless to modify it, but it would mean we'd see a diff when comparing to upstream. again, in this case that's probably fine (I doubt we'll update bullet, or if we do, we'd do it as a whole, not incrementally).
so overall, I'm not sure what's best here.
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 bullet, poppler, and freetype haven't been updated from upstream since 2011 so personally I think it will be fine.
If you want I'll still happily exclude them in this PR.
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.
(I think eventually we will have to fix some of them, but probably only after we add CI settings for Python 3?)
Is the goal ultimately to move to python3 for all of emscripten? |
macOS does not ship python3 by default even in the latest version, so I don't think we want to migrate to requiring python3. I think we are in a good spot with respect to dual python 2 + python 3 support, by using the dynamic routing scripts to run python 2 if one invokes python 3, so from the shell perspective, invoking Emscripten does seem to work from python 3. If someone does want to contribute and maintain "real" python 3 support, I don't think I would be opposed, but we do also want to support python 2 for a healthy amount of time before we would be able to abandon ship on that. |
Let's try to be extremely conservative with these kind of mass changes. Could we first migrate only everything that does not have an upstream, and everything that does not live in Also, do we know what is the minimum imposed python 2 version after this kind of change? |
For emrun, that lives in upstream in https://github.com/juj/emrun.git, so let's leave that one out in here first (do the change via that repository) |
I agree for the upstream thing, but why the whole tests/ and site/? It will definitely make the diff smaller, though. PS: (I didn't know there is a separate repo for emrun 😮) |
8653eeb
to
8449dd4
Compare
Rebased and excluded |
Running tests locally, I see a failure on
|
8449dd4
to
af0bce1
Compare
Fixed it, thanks! |
Thanks! How about merging the just-merged incoming to here? It would include your travis testing support, so it could also verify everything works. |
af0bce1
to
5d42964
Compare
Rebased again, the test passes 😃 (at least on my repository). |
|
Looking in the docs, we seem to mention 2.7 already almost everywhere, which is good. But I think we should update |
Python 2.7 has been out for 7 years, I think it's safe to require that. |
Yeah, Python 2.6 is something we do not want to support. What I'm curious is if there are some things that would require some specific newer version than Python 2.7.0, and if so, that's alright as well, but good to be diligent and mention those somewhere. |
My thinking here was the reason to make the diff smaller, and have those dealt with in separate pull requests. The
Thanks for the PR there! |
This PR looks good to me to merge. |
As a followup we should update those docs to say python 2.7 consistently. |
This breaks emcc.py for me:
|
Hmm, it seems it is a old Python bug that has been fixed back in 2014. https://bugs.python.org/issue21591 This effectively makes the minimum compatible Python version to 2.7.9. Hmm. |
#5685 fixes that. |
I got some help from
2to3 --f print --f exec
to fix the Python 3 syntax compatibility in progressive way.Thus, this PR includes these changes:
The next phases would be error handlings, imports, maps/filters and so on.