about summary refs log tree commit diff
path: root/src/ci/cpu-usage-over-time.py
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-07 03:31:23 +0000
committerbors <bors@rust-lang.org>2021-07-07 03:31:23 +0000
commitc5e344f7747dbd7e7d4b209e3c480deb5979a56f (patch)
tree0390ebc50ec6f445460fefd566a67be3be79a088 /src/ci/cpu-usage-over-time.py
parentc0bd5a584da4f26a1391163a0bdc21b34cf1ba54 (diff)
parent51968854f4c3bd9cc54cf35c3e84047adfc6cf21 (diff)
downloadrust-c5e344f7747dbd7e7d4b209e3c480deb5979a56f.tar.gz
rust-c5e344f7747dbd7e7d4b209e3c480deb5979a56f.zip
Auto merge of #86920 - JohnTitor:rollup-buvzpkr, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #80918 (Add Integer::log variants)
 - #86717 (Rename some Rust 2021 lints to better names )
 - #86819 (Clean up rustdoc IDs)
 - #86880 (Test ManuallyDrop::clone_from.)
 - #86906 (Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs)
 - #86907 (Migrate `cpu-usage-over-time.py` to Python 3)
 - #86916 (rewrote documentation for thread::yield_now())
 - #86919 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/ci/cpu-usage-over-time.py')
-rw-r--r--src/ci/cpu-usage-over-time.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ci/cpu-usage-over-time.py b/src/ci/cpu-usage-over-time.py
index 78ac0603681..267c3964d0d 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 datetime
 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: