diff --git a/src/ci/cpu-usage-over-time.py b/src/ci/cpu-usage-over-time.py index 78ac060368193..267c3964d0d69 100644 --- a/src/ci/cpu-usage-over-time.py +++ b/src/ci/cpu-usage-over-time.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ignore-tidy-linelength # This is a small script that we use on CI to collect CPU usage statistics of @@ -37,7 +37,10 @@ import sys import time -if sys.platform == 'linux2': +# Python 3.3 changed the value of `sys.platform` on Linux from "linux2" to just +# "linux". We check here with `.startswith` to keep compatibility with older +# Python versions (especially Python 2.7). +if sys.platform.startswith('linux'): class State: def __init__(self): with open('/proc/stat', 'r') as file: diff --git a/src/ci/scripts/collect-cpu-stats.sh b/src/ci/scripts/collect-cpu-stats.sh index 08065431f9816..853b4628fab2f 100755 --- a/src/ci/scripts/collect-cpu-stats.sh +++ b/src/ci/scripts/collect-cpu-stats.sh @@ -6,4 +6,4 @@ set -euo pipefail IFS=$'\n\t' -python src/ci/cpu-usage-over-time.py &> cpu-usage.csv & +python3 src/ci/cpu-usage-over-time.py &> cpu-usage.csv &