Mike Frysinger | e7379dc | 2019-01-30 14:35:39 -0500 | [diff] [blame] | 1 | # Supported Python Versions |
| 2 | |
Mike Frysinger | a99f19f | 2024-01-04 12:41:32 -0500 | [diff] [blame] | 3 | > **Warning: The "master" branch is no longer used. Use "main" instead.**<br> |
| 4 | > https://gerrit.googlesource.com/git-repo/+/HEAD/docs/python-support.md |
| 5 | |
Mike Frysinger | e7379dc | 2019-01-30 14:35:39 -0500 | [diff] [blame] | 6 | With Python 2.7 officially going EOL on [01 Jan 2020](https://pythonclock.org/), |
| 7 | we need a support plan for the repo project itself. |
| 8 | Inevitably, there will be a long tail of users who still want to use Python 2 on |
| 9 | their old LTS/corp systems and have little power to change the system. |
| 10 | |
| 11 | ## Summary |
| 12 | |
Mike Frysinger | d1e93dd | 2019-10-10 18:34:39 -0400 | [diff] [blame] | 13 | * Python 3.6 (released Dec 2016) is required by default starting with repo-2.x. |
Mike Frysinger | e7379dc | 2019-01-30 14:35:39 -0500 | [diff] [blame] | 14 | * Older versions of Python (e.g. v2.7) may use the legacy feature-frozen branch |
Mike Frysinger | d1e93dd | 2019-10-10 18:34:39 -0400 | [diff] [blame] | 15 | based on repo-1.x. |
Mike Frysinger | e7379dc | 2019-01-30 14:35:39 -0500 | [diff] [blame] | 16 | |
| 17 | ## Overview |
| 18 | |
| 19 | We provide a branch for Python 2 users that is feature-frozen. |
| 20 | Bugfixes may be added on a best-effort basis or from the community, but largely |
| 21 | no new features will be added, nor is support guaranteed. |
| 22 | |
| 23 | Users can select this during `repo init` time via the [repo launcher]. |
| 24 | Otherwise the default branches (e.g. stable & master) will be used which will |
| 25 | require Python 3. |
| 26 | |
| 27 | This means the [repo launcher] needs to support both Python 2 & Python 3, but |
| 28 | since it doesn't import any other repo code, this shouldn't be too problematic. |
| 29 | |
| 30 | The master branch will require Python 3.6 at a minimum. |
| 31 | If the system has an older version of Python 3, then users will have to select |
| 32 | the legacy Python 2 branch instead. |
| 33 | |
Mike Frysinger | f7c5160 | 2019-06-18 17:23:39 -0400 | [diff] [blame] | 34 | ### repo hooks |
Mike Frysinger | e7379dc | 2019-01-30 14:35:39 -0500 | [diff] [blame] | 35 | |
Mike Frysinger | f7c5160 | 2019-06-18 17:23:39 -0400 | [diff] [blame] | 36 | Projects that use [repo hooks] run on independent schedules. |
| 37 | They might migrate to Python 3 earlier or later than us. |
| 38 | To support them, we'll probe the shebang of the hook script and if we find an |
| 39 | interpreter in there that indicates a different version than repo is currently |
| 40 | running under, we'll attempt to reexec ourselves under that. |
| 41 | |
| 42 | For example, a hook with a header like `#!/usr/bin/python2` will have repo |
| 43 | execute `/usr/bin/python2` to execute the hook code specifically if repo is |
| 44 | currently running Python 3. |
| 45 | |
| 46 | For more details, consult the [repo hooks] documentation. |
| 47 | |
| 48 | |
| 49 | [repo hooks]: ./repo-hooks.md |
Mike Frysinger | e7379dc | 2019-01-30 14:35:39 -0500 | [diff] [blame] | 50 | [repo launcher]: ../repo |