diff options
author | 2022-09-09 19:39:25 -0700 | |
---|---|---|
committer | 2023-03-09 11:56:04 -0800 | |
commit | edc4c505f9cad536b527a5f26852f6844df3c05e (patch) | |
tree | fee0ecac1fb740e482f6a2189e35b2acc4085275 /python/python.go | |
parent | ae3e4cc2fd4e74e94510e671a98769ec428f6f39 (diff) |
Make using python 2 an error
Except if BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES is set, and except for
some core py2 modules that can't be removed until python2 is fully gone.
Bug: 203436762
Test: m nothing
Change-Id: I62ccb6f5687eab1e79c372ffc234a90ca5b566ac
Diffstat (limited to 'python/python.go')
-rw-r--r-- | python/python.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/python/python.go b/python/python.go index 0ae7b3691..c7c523dfb 100644 --- a/python/python.go +++ b/python/python.go @@ -263,6 +263,12 @@ func versionSplitMutator() func(android.BottomUpMutatorContext) { versionProps = append(versionProps, props.Version.Py3) } if proptools.BoolDefault(props.Version.Py2.Enabled, false) { + if !mctx.DeviceConfig().BuildBrokenUsesSoongPython2Modules() && + mctx.ModuleName() != "par_test" && + mctx.ModuleName() != "py2-cmd" && + mctx.ModuleName() != "py2-stdlib" { + mctx.PropertyErrorf("version.py2.enabled", "Python 2 is no longer supported, please convert to python 3. This error can be temporarily overridden by setting BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES := true in the product configuration") + } versionNames = append(versionNames, pyVersion2) versionProps = append(versionProps, props.Version.Py2) } |