Skip to content

Commit 9682f0e

Browse files
committed
Auto merge of #66605 - GuillaumeGomez:drop-python2, r=Mark-Simulacrum
Stop explicitly depending on python 2 This PR revises our previous policy of officially only supporting and testing with python 2 in the CI environment to instead test with python 3. It also changes the defaults to python 3 in our various scripts (usually, by way of `python` rather than `python3` to preserve compatibility with systems that do not have a python 3 available). The effect of this is that we expect all new patches to support python 3 (and will test as such). We explicitly also expect that patches support python 2.7 as well -- and test as such, though only on one builder. This is intended as a temporary, though likely long-lived, measure to preserve compatibility while looking towards the future which is likely to be a python 3 only world. We do not at this point set a timeline for when we'll drop support for python 2.7; it's plausible that this is months or years into the future, depending on how quickly the ecosystem drops support and how painful it is for us to maintain that support over time. Closes #65063 (as far as I can tell; please file explicit and separate issues or PRs if not).
2 parents dbc3cfd + 38eb369 commit 9682f0e

File tree

62 files changed

+131
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+131
-111
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ or reading the [rustc dev guide][rustcguidebuild].
2727
1. Make sure you have installed the dependencies:
2828

2929
* `g++` 5.1 or later or `clang++` 3.5 or later
30-
* `python` 2.7 (but not 3.x)
30+
* `python` 3 or 2.7
3131
* GNU `make` 3.81 or later
3232
* `cmake` 3.4.3 or later
3333
* `curl`
@@ -113,7 +113,7 @@ build.
113113
make \
114114
diffutils \
115115
tar \
116-
mingw-w64-x86_64-python2 \
116+
mingw-w64-x86_64-python \
117117
mingw-w64-x86_64-cmake \
118118
mingw-w64-x86_64-gcc
119119
```

config.toml.example

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,9 @@
168168

169169
# Python interpreter to use for various tasks throughout the build, notably
170170
# rustdoc tests, the lldb python interpreter, and some dist bits and pieces.
171-
# Note that Python 2 is currently required.
172171
#
173-
# Defaults to python2.7, then python2. If neither executable can be found, then
174-
# it defaults to the Python interpreter used to execute x.py.
175-
#python = "python2.7"
172+
# Defaults to the Python interpreter used to execute x.py.
173+
#python = "python"
176174

177175
# Force Cargo to check that Cargo.lock describes the precise dependency
178176
# set that all the Cargo.toml files create, instead of updating it.

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ try() {
1111
fi
1212
}
1313

14+
try python3 "$@"
1415
try python2.7 "$@"
1516
try python27 "$@"
1617
try python2 "$@"

src/bootstrap/job.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ pub unsafe fn setup(build: &mut Build) {
103103
};
104104

105105
let parent = OpenProcess(PROCESS_DUP_HANDLE, FALSE, pid.parse().unwrap());
106-
assert!(!parent.is_null(), "{}", io::Error::last_os_error());
106+
assert!(
107+
!parent.is_null(),
108+
"PID `{}` doesn't seem to exist: {}",
109+
pid,
110+
io::Error::last_os_error()
111+
);
107112
let mut parent_handle = ptr::null_mut();
108113
let r = DuplicateHandle(
109114
GetCurrentProcess(),

src/bootstrap/sanity.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ pub fn check(build: &mut Build) {
132132
.python
133133
.take()
134134
.map(|p| cmd_finder.must_have(p))
135-
.or_else(|| cmd_finder.maybe_have("python2.7"))
136-
.or_else(|| cmd_finder.maybe_have("python2"))
137135
.or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py
138136
.or_else(|| Some(cmd_finder.must_have("python")));
139137

src/ci/docker/arm-android/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ENV TARGETS=arm-linux-androideabi
3131

3232
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14
3333

34-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
34+
ENV SCRIPT python3 ../x.py test --target $TARGETS
3535

3636
COPY scripts/sccache.sh /scripts/
3737
RUN sh /scripts/sccache.sh

src/ci/docker/armhf-gnu/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
1414
libc6-dev \
1515
libc6-dev-armhf-cross \
1616
make \
17-
python2.7 \
17+
python3 \
1818
qemu-system-arm \
1919
xz-utils
2020

@@ -78,6 +78,6 @@ COPY scripts/sccache.sh /scripts/
7878
RUN sh /scripts/sccache.sh
7979

8080
ENV RUST_CONFIGURE_ARGS --qemu-armhf-rootfs=/tmp/rootfs
81-
ENV SCRIPT python2.7 ../x.py test --target arm-unknown-linux-gnueabihf
81+
ENV SCRIPT python3 ../x.py test --target arm-unknown-linux-gnueabihf
8282

8383
ENV NO_CHANGE_USER=1

src/ci/docker/disabled/aarch64-gnu/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
1414
libc6-dev \
1515
libc6-dev-arm64-cross \
1616
make \
17-
python2.7 \
17+
python3 \
1818
qemu-system-aarch64 \
1919
xz-utils
2020

@@ -75,5 +75,5 @@ RUN sh /scripts/sccache.sh
7575

7676
ENV RUST_CONFIGURE_ARGS \
7777
--qemu-aarch64-rootfs=/tmp/rootfs
78-
ENV SCRIPT python2.7 ../x.py test --target aarch64-unknown-linux-gnu
78+
ENV SCRIPT python3 ../x.py test --target aarch64-unknown-linux-gnu
7979
ENV NO_CHANGE_USER=1

src/ci/docker/disabled/asmjs/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
66
file \
77
curl \
88
ca-certificates \
9-
python \
9+
python3 \
1010
git \
1111
cmake \
1212
sudo \
@@ -33,7 +33,7 @@ ENV EMCC_CFLAGS=-O1
3333
# Emscripten installation is user-specific
3434
ENV NO_CHANGE_USER=1
3535

36-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
36+
ENV SCRIPT python3 ../x.py test --target $TARGETS
3737

3838
# This is almost identical to the wasm32-unknown-emscripten target, so
3939
# running with assertions again is not useful

src/ci/docker/disabled/dist-aarch64-android/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ENV RUST_CONFIGURE_ARGS \
1919
--enable-extended \
2020
--enable-cargo-openssl-static
2121

22-
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS
22+
ENV SCRIPT python3 ../x.py dist --target $HOSTS --host $HOSTS
2323

2424
COPY scripts/sccache.sh /scripts/
2525
RUN sh /scripts/sccache.sh

0 commit comments

Comments
 (0)