-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Makefile: Distinguish between Python and legacy Python #25118
Conversation
How about we leave |
@cclauss do you know whether I'm also wondering if we're going to break existing use by switching out the default from We could leave I doubt anyone's using |
It would be much more with the trend if we change $PYTHON --> $LEGACY_PYTHON and use $PYTHON for Python 3. |
And then only use |
After reflecting over my morning ☕️ ... python2 and python3 are standard names across platforms. Let's track with that in our Makefile variable names. On current versions of several Linux distros python --version already defaults to Python 3. $LEGACY_PYTHON is just too long-winded. Given that part of the Python philosophy is that explicit is better than implicit, let's stick with PYTHON2 and PYTHON3 as is already the case in this PR. Let's transition our use in Makefile one step at a time... Step one (this PR) is to run flake8 on both PYTHON2 and PYTHON3 because the two have different Abstract Syntax Trees so they generate different reports. Once this PR lands, we can walk thru Makefile and change PYTHON2 --> PYTHON3 and fix issues as we go. This follows the Facebook model for how they successfully completed their transitions: Treat Python 3 incompatibility as a bug and fix bugs as we go. |
@cclauss but that doesn't address the fact that You could introduce special behaviour that is only invoked if someone supplies a We could deprecate |
Sorry... I do not understand. PYTHON is a local variable created on line 4 of this Makefile. It is not in the wild, it is defined and used in this Makefile. Try which -a python python2 python3 and you will probably discover python and python2 are both pointing to the exact same executable. This PR is merely proposing that we leverage that convention to always be explicit about which Python we want to use. This enables us to port in a controlled way. Initially, we will leave all current uses on PYTHON2 and add just one new run of flake8 testing on PYTHON3. Once we have proven that this works, future PRs can modify other tasks in this Makefile to use PYTHON3 instead of PYTHON2. Sometime in the next 12 months, we should remove the PYTHON2 variable from this Makefile because we do not want to build software on an insecure base. |
|
I think we can follow this route, given that removing |
@rvagg Thanks for your explanation... Now all of your points make sense to me. Could we move to a model where we allow the caller to specify:
And this Makefile does the right thing to cover all cases? My thought was this (please help with Makefile syntax!)...
|
Maybe one more corner case... If Python 3 is not installed then PYTHON3 := $(PYTHON2) |
I am kinda worried about introducing conditional assignment for PYTHON3. If we allow that and if people start using it, getting rid of that variable is going to be difficult again. |
Understood. What about an approach where PYTHON2 and PYTHON3 are merely local variables.? We allow the caller to specify:
And this Makefile does the right thing to cover both cases? My thought was this (please help with Makefile syntax!)...
With the corner cases being where python2 is not installed and where python3 is not installed. |
Thanks folks. I am going to close this one down. I have been slow to understand what you both probably understood from the beginning. We can get everything that we are looking for just by modifying the call:
|
@rvagg Your review please.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes