Skip to content
Permalink
Browse files
Enforce Python 3 as much as possible
  • Loading branch information
GuillaumeGomez authored and Mark-Simulacrum committed Apr 10, 2020
1 parent 42abbd8 commit 38eb369fa4d06e55869a8fae62796a7b0085a5bd
Showing 62 changed files with 131 additions and 111 deletions.
@@ -27,7 +27,7 @@ or reading the [rustc dev guide][rustcguidebuild].
1. Make sure you have installed the dependencies:

* `g++` 5.1 or later or `clang++` 3.5 or later
* `python` 2.7 (but not 3.x)
* `python` 3 or 2.7
* GNU `make` 3.81 or later
* `cmake` 3.4.3 or later
* `curl`
@@ -113,7 +113,7 @@ build.
make \
diffutils \
tar \
mingw-w64-x86_64-python2 \
mingw-w64-x86_64-python \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-gcc
```
@@ -168,11 +168,9 @@

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

# Force Cargo to check that Cargo.lock describes the precise dependency
# set that all the Cargo.toml files create, instead of updating it.
@@ -11,6 +11,7 @@ try() {
fi
}

try python3 "$@"
try python2.7 "$@"
try python27 "$@"
try python2 "$@"
@@ -103,7 +103,12 @@ pub unsafe fn setup(build: &mut Build) {
};

let parent = OpenProcess(PROCESS_DUP_HANDLE, FALSE, pid.parse().unwrap());
assert!(!parent.is_null(), "{}", io::Error::last_os_error());
assert!(
!parent.is_null(),
"PID `{}` doesn't seem to exist: {}",
pid,
io::Error::last_os_error()
);
let mut parent_handle = ptr::null_mut();
let r = DuplicateHandle(
GetCurrentProcess(),
@@ -132,8 +132,6 @@ pub fn check(build: &mut Build) {
.python
.take()
.map(|p| cmd_finder.must_have(p))
.or_else(|| cmd_finder.maybe_have("python2.7"))
.or_else(|| cmd_finder.maybe_have("python2"))
.or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py
.or_else(|| Some(cmd_finder.must_have("python")));

@@ -31,7 +31,7 @@ ENV TARGETS=arm-linux-androideabi

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

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

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@@ -14,7 +14,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
libc6-dev \
libc6-dev-armhf-cross \
make \
python2.7 \
python3 \
qemu-system-arm \
xz-utils

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

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

ENV NO_CHANGE_USER=1
@@ -14,7 +14,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
libc6-dev \
libc6-dev-arm64-cross \
make \
python2.7 \
python3 \
qemu-system-aarch64 \
xz-utils

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

ENV RUST_CONFIGURE_ARGS \
--qemu-aarch64-rootfs=/tmp/rootfs
ENV SCRIPT python2.7 ../x.py test --target aarch64-unknown-linux-gnu
ENV SCRIPT python3 ../x.py test --target aarch64-unknown-linux-gnu
ENV NO_CHANGE_USER=1
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python \
python3 \
git \
cmake \
sudo \
@@ -33,7 +33,7 @@ ENV EMCC_CFLAGS=-O1
# Emscripten installation is user-specific
ENV NO_CHANGE_USER=1

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

# This is almost identical to the wasm32-unknown-emscripten target, so
# running with assertions again is not useful
@@ -19,7 +19,7 @@ ENV RUST_CONFIGURE_ARGS \
--enable-extended \
--enable-cargo-openssl-static

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

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@@ -33,11 +33,11 @@ ENV RUST_CONFIGURE_ARGS \
# build to finish we use --warn-unresolved-symbols. Note that the missing
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
ENV SCRIPT \
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
python3 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
rm /android/ndk/arm && \
ln -s /android/ndk/arm-14 /android/ndk/arm && \
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
python3 ../x.py dist --host $HOSTS --target $HOSTS)

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@@ -33,11 +33,11 @@ ENV RUST_CONFIGURE_ARGS \
# build to finish we use --warn-unresolved-symbols. Note that the missing
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
ENV SCRIPT \
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
python3 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
rm /android/ndk/x86 && \
ln -s /android/ndk/x86-14 /android/ndk/x86 && \
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
python3 ../x.py dist --host $HOSTS --target $HOSTS)

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -23,4 +23,4 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=powerpc-unknown-linux-gnuspe

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -23,4 +23,4 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=sparc64-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -19,7 +19,7 @@ ENV RUST_CONFIGURE_ARGS \
--enable-extended \
--enable-cargo-openssl-static

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

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -33,4 +33,4 @@ ENV \
ENV HOSTS=x86_64-unknown-dragonfly

ENV RUST_CONFIGURE_ARGS --enable-extended
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
make \
nasm \
pkg-config \
python2.7 \
python3 \
sudo \
texinfo \
wget \
@@ -46,4 +46,4 @@ ENV RUST_CONFIGURE_ARGS --disable-jemalloc \
--set=$TARGET.cc=x86_64-unknown-haiku-gcc \
--set=$TARGET.cxx=x86_64-unknown-haiku-g++ \
--set=$TARGET.llvm-config=/bin/llvm-config-haiku
ENV SCRIPT python2.7 ../x.py dist --host=$HOST --target=$HOST
ENV SCRIPT python3 ../x.py dist --host=$HOST --target=$HOST
@@ -19,4 +19,4 @@ ENV \
CXX_x86_64_unknown_redox=x86_64-unknown-redox-g++

ENV RUST_CONFIGURE_ARGS --enable-extended
ENV SCRIPT python2.7 ../x.py dist --target x86_64-unknown-redox
ENV SCRIPT python3 ../x.py dist --target x86_64-unknown-redox
@@ -36,4 +36,4 @@ ENV RUST_CONFIGURE_ARGS \
--enable-extended \
--enable-profiler \
--disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -32,7 +32,7 @@ ENV RUST_CONFIGURE_ARGS \
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
--disable-docs

ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
ENV SCRIPT python3 ../x.py dist --target $TARGETS

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@@ -28,4 +28,4 @@ ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
ENV HOSTS=arm-unknown-linux-gnueabi

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -28,4 +28,4 @@ ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
ENV HOSTS=arm-unknown-linux-gnueabihf

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -28,4 +28,4 @@ ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
ENV HOSTS=armv7-unknown-linux-gnueabihf

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
xz-utils \
@@ -46,5 +46,5 @@ ENV CFLAGS_i586_unknown_linux_musl=-Wa,-mrelax-relocations=no
ENV TARGETS=i586-unknown-linux-gnu,i686-unknown-linux-musl

ENV SCRIPT \
python2.7 ../x.py test --target $TARGETS && \
python2.7 ../x.py dist --target $TARGETS,i586-unknown-linux-musl
python3 ../x.py test --target $TARGETS && \
python3 ../x.py dist --target $TARGETS,i586-unknown-linux-musl
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -30,4 +30,4 @@ ENV \
ENV HOSTS=i686-unknown-freebsd

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -23,4 +23,4 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mips-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -22,4 +22,4 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mips64-unknown-linux-gnuabi64

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -23,4 +23,4 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mips64el-unknown-linux-gnuabi64

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
@@ -22,4 +22,4 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mipsel-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -35,4 +35,4 @@ ENV \
ENV HOSTS=powerpc-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -36,4 +36,4 @@ ENV \
ENV HOSTS=powerpc64-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -33,4 +33,4 @@ ENV \
ENV HOSTS=powerpc64le-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
@@ -35,4 +35,4 @@ ENV \
ENV HOSTS=s390x-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

0 comments on commit 38eb369

Please sign in to comment.