aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Spang <spang@google.com>2021-04-10 05:41:16 -0400
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-04-12 18:54:08 +0000
commitdb0992d39c15747bea91703d3349e318b5dd801a (patch)
tree957f544c364f3512a0da0fb265dac95189484392
parenta77e5e7a1cfca3b109e1bcf6536444080e6bee44 (diff)
downloadpigweed-db0992d39c15747bea91703d3349e318b5dd801a.tar.gz
pw_env_setup: Support Python 3.9
Currently there is no way to configure environment checks in pw_env_setup, and often these checks are diagnosting downstream adjustments rather than errors. Loosen up these checks to at least permit Python 3.9, which is the default now in some distros. Change-Id: Ibb99acdef7f98e7b327ac9ee49e52c0a83bdb0fc Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40362 Reviewed-by: Rob Mohr <mohrr@google.com> Commit-Queue: Rob Mohr <mohrr@google.com> Commit-Queue: Michael Spang <spang@google.com>
-rw-r--r--pw_doctor/docs.rst5
-rwxr-xr-xpw_doctor/py/pw_doctor/doctor.py3
-rw-r--r--pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py3
3 files changed, 9 insertions, 2 deletions
diff --git a/pw_doctor/docs.rst b/pw_doctor/docs.rst
index 51087a5e8..1bd65783c 100644
--- a/pw_doctor/docs.rst
+++ b/pw_doctor/docs.rst
@@ -7,5 +7,10 @@ pw_doctor
it checks that things exactly match what is expected and it checks that things
look compatible without.
+Currently pw_doctor expects the running python to be Python 3.8 or 3.9.
+
+Projects that adjust the behavior of pw_env_setup may need to customize
+these checks, but unfortunately this is not supported yet.
+
.. note::
The documentation for this module is currently incomplete.
diff --git a/pw_doctor/py/pw_doctor/doctor.py b/pw_doctor/py/pw_doctor/doctor.py
index f2af51869..16fb2200e 100755
--- a/pw_doctor/py/pw_doctor/doctor.py
+++ b/pw_doctor/py/pw_doctor/doctor.py
@@ -200,8 +200,9 @@ def python_version(ctx: DoctorContext):
"""Check the Python version is correct."""
actual = sys.version_info
expected = (3, 8)
+ latest = (3, 9)
if (actual[0:2] < expected or actual[0] != expected[0]
- or actual[0:2] > expected):
+ or actual[0:2] > latest):
# If we get the wrong version but it still came from CIPD print a
# warning but give it a pass.
if 'chromium' in sys.version:
diff --git a/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py b/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py
index 9a227c869..d7134d4a9 100644
--- a/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py
+++ b/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py
@@ -130,7 +130,8 @@ def install(
version = subprocess.check_output(
(python, '--version'), stderr=subprocess.STDOUT).strip().decode()
# We expect Python 3.8, but if it came from CIPD let it pass anyway.
- if '3.8' not in version and 'chromium' not in version:
+ if ('3.8' not in version and '3.9' not in version
+ and 'chromium' not in version):
print('=' * 60, file=sys.stderr)
print('Unexpected Python version:', version, file=sys.stderr)
print('=' * 60, file=sys.stderr)