mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
f7c51606f0
As we convert repo to support Python 3, the version of Python that we use might not be the version that repo hooks users have written for. Since repo upgrades are not immediate, and not easily under direct control of end users (relative to the projects maintaining the hook code), allow hook authors to declare the version of Python that they want to use. Now repo will read the shebang from the hook script and compare it against the version of Python repo itself is running under. If they differ, we'll try to execute a separate instance of Python and have it load & execute the hook. If things are compatible, then we still use the inprocess execution logic that we have today. This allows repo hook users to upgrade on their own schedule (they could even upgrade to Python 3 ahead of us) without having to worry about their supported version being exactly in sync with repo's. Bug: https://crbug.com/gerrit/10418 Change-Id: I97c7c96b64fb2ee465c39b90e9bdcc76394a146a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/228432 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
# Supported Python Versions
|
|
|
|
With Python 2.7 officially going EOL on [01 Jan 2020](https://pythonclock.org/),
|
|
we need a support plan for the repo project itself.
|
|
Inevitably, there will be a long tail of users who still want to use Python 2 on
|
|
their old LTS/corp systems and have little power to change the system.
|
|
|
|
## Summary
|
|
|
|
* Python 3.6 (released Dec 2016) is required by default starting with repo-1.14.
|
|
* Older versions of Python (e.g. v2.7) may use the legacy feature-frozen branch
|
|
based on repo-1.13.
|
|
|
|
## Overview
|
|
|
|
We provide a branch for Python 2 users that is feature-frozen.
|
|
Bugfixes may be added on a best-effort basis or from the community, but largely
|
|
no new features will be added, nor is support guaranteed.
|
|
|
|
Users can select this during `repo init` time via the [repo launcher].
|
|
Otherwise the default branches (e.g. stable & master) will be used which will
|
|
require Python 3.
|
|
|
|
This means the [repo launcher] needs to support both Python 2 & Python 3, but
|
|
since it doesn't import any other repo code, this shouldn't be too problematic.
|
|
|
|
The master branch will require Python 3.6 at a minimum.
|
|
If the system has an older version of Python 3, then users will have to select
|
|
the legacy Python 2 branch instead.
|
|
|
|
### repo hooks
|
|
|
|
Projects that use [repo hooks] run on independent schedules.
|
|
They might migrate to Python 3 earlier or later than us.
|
|
To support them, we'll probe the shebang of the hook script and if we find an
|
|
interpreter in there that indicates a different version than repo is currently
|
|
running under, we'll attempt to reexec ourselves under that.
|
|
|
|
For example, a hook with a header like `#!/usr/bin/python2` will have repo
|
|
execute `/usr/bin/python2` to execute the hook code specifically if repo is
|
|
currently running Python 3.
|
|
|
|
For more details, consult the [repo hooks] documentation.
|
|
|
|
|
|
[repo hooks]: ./repo-hooks.md
|
|
[repo launcher]: ../repo
|