diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/python-support.md | 15 | ||||
-rw-r--r-- | docs/repo-hooks.md | 25 |
2 files changed, 40 insertions, 0 deletions
diff --git a/docs/python-support.md b/docs/python-support.md index af19cd05..35806de7 100644 --- a/docs/python-support.md +++ b/docs/python-support.md | |||
@@ -28,5 +28,20 @@ The master branch will require Python 3.6 at a minimum. | |||
28 | If the system has an older version of Python 3, then users will have to select | 28 | If the system has an older version of Python 3, then users will have to select |
29 | the legacy Python 2 branch instead. | 29 | the legacy Python 2 branch instead. |
30 | 30 | ||
31 | ### repo hooks | ||
31 | 32 | ||
33 | Projects that use [repo hooks] run on independent schedules. | ||
34 | They might migrate to Python 3 earlier or later than us. | ||
35 | To support them, we'll probe the shebang of the hook script and if we find an | ||
36 | interpreter in there that indicates a different version than repo is currently | ||
37 | running under, we'll attempt to reexec ourselves under that. | ||
38 | |||
39 | For example, a hook with a header like `#!/usr/bin/python2` will have repo | ||
40 | execute `/usr/bin/python2` to execute the hook code specifically if repo is | ||
41 | currently running Python 3. | ||
42 | |||
43 | For more details, consult the [repo hooks] documentation. | ||
44 | |||
45 | |||
46 | [repo hooks]: ./repo-hooks.md | ||
32 | [repo launcher]: ../repo | 47 | [repo launcher]: ../repo |
diff --git a/docs/repo-hooks.md b/docs/repo-hooks.md index e198b390..7c37c30e 100644 --- a/docs/repo-hooks.md +++ b/docs/repo-hooks.md | |||
@@ -83,6 +83,31 @@ then check it directly. Hooks should not normally modify the active git repo | |||
83 | the user. Although user interaction is discouraged in the common case, it can | 83 | the user. Although user interaction is discouraged in the common case, it can |
84 | be useful when deploying automatic fixes. | 84 | be useful when deploying automatic fixes. |
85 | 85 | ||
86 | ### Shebang Handling | ||
87 | |||
88 | *** note | ||
89 | This is intended as a transitional feature. Hooks are expected to eventually | ||
90 | migrate to Python 3 only as Python 2 is EOL & deprecated. | ||
91 | *** | ||
92 | |||
93 | If the hook is written against a specific version of Python (either 2 or 3), | ||
94 | the script can declare that explicitly. Repo will then attempt to execute it | ||
95 | under the right version of Python regardless of the version repo itself might | ||
96 | be executing under. | ||
97 | |||
98 | Here are the shebangs that are recognized. | ||
99 | |||
100 | * `#!/usr/bin/env python` & `#!/usr/bin/python`: The hook is compatible with | ||
101 | Python 2 & Python 3. For maximum compatibility, these are recommended. | ||
102 | * `#!/usr/bin/env python2` & `#!/usr/bin/python2`: The hook requires Python 2. | ||
103 | Version specific names like `python2.7` are also recognized. | ||
104 | * `#!/usr/bin/env python3` & `#!/usr/bin/python3`: The hook requires Python 3. | ||
105 | Version specific names like `python3.6` are also recognized. | ||
106 | |||
107 | If no shebang is detected, or does not match the forms above, we assume that the | ||
108 | hook is compatible with both Python 2 & Python 3 as if `#!/usr/bin/python` was | ||
109 | used. | ||
110 | |||
86 | ## Hooks | 111 | ## Hooks |
87 | 112 | ||
88 | Here are all the points available for hooking. | 113 | Here are all the points available for hooking. |