Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions cpython-unix/build-binutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,12 @@

set -ex

ROOT=$(pwd)
SCCACHE="${ROOT}/sccache"

cd /build

tar -xf binutils-${BINUTILS_VERSION}.tar.xz
mkdir binutils-objdir
pushd binutils-objdir

EXTRA_VARS=

if [ -x "${SCCACHE}" ]; then
"${SCCACHE}" --start-server
export CC="${SCCACHE} /usr/bin/gcc"
export STAGE_CC_WRAPPER="${SCCACHE}"
fi

# gprofng requires a bison newer than what we have. So just disable it.
../binutils-${BINUTILS_VERSION}/configure \
--build=x86_64-unknown-linux-gnu \
Expand Down
30 changes: 0 additions & 30 deletions cpython-unix/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,6 @@
MACOS_ALLOW_FRAMEWORKS = {"CoreFoundation"}


def install_sccache(build_env):
"""Attempt to install sccache into the build environment.

This will attempt to locate a sccache executable and copy it
into the root directory of the build environment.
"""
candidates = [
# Prefer a binary in the project itself.
ROOT / "sccache",
]

# Look for sccache in $PATH, but only if the build environment
# isn't isolated, as copying binaries into an isolated environment
# may not run. And running sccache in an isolated environment won't
# do anything meaningful unless an external cache is being used.
if not build_env.is_isolated:
for path in os.environ.get("PATH", "").split(":"):
if not path:
continue

candidates.append(pathlib.Path(path) / "sccache")

for candidate in candidates:
if candidate.exists():
build_env.copy_file(candidate)
return


def add_target_env(env, build_platform, target_triple, build_env):
add_env_common(env)

Expand Down Expand Up @@ -302,8 +274,6 @@ def build_binutils(client, image, host_platform):
archive = download_entry("binutils", DOWNLOADS_PATH)

with build_environment(client, image) as build_env:
install_sccache(build_env)

build_env.copy_file(archive)
build_env.copy_file(SUPPORT / "build-binutils.sh")

Expand Down
31 changes: 0 additions & 31 deletions cpython-unix/sccache-wrapper.sh

This file was deleted.

35 changes: 0 additions & 35 deletions docs/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,38 +104,3 @@ You will need to specify the path to a ``sh.exe`` installed from cygwin. e.g.

To build a 32-bit x86 binary, simply use an ``x86 Native Tools
Command Prompt`` instead of ``x64``.

Using sccache to Speed up Builds
================================

Builds can take a long time.

python-build-standalone can automatically detect and use the
`sccache <https://github.com/mozilla/sccache>`_ compiler cache to speed
up subsequent builds on UNIX-like platforms. ``sccache`` can shave dozens
of minutes from fresh builds, even on a 16 core CPU!

If there is an executable ``sccache`` in the source directory, it will
automatically be copied into the build environment and used. For non-container
builds, an ``sccache`` executable is also searched for on ``PATH``.

The ``~/.python-build-standalone-env`` file is read if it exists (the format is
``key=value`` pairs) and variables are added to the build environment.

In addition, environment variables ``AWS_ACCESS_KEY_ID``,
``AWS_SECRET_ACCESS_KEY``, and any variable beginning with ``SCCACHE_`` are
automatically added to the build environment.

The environment variable support enables you to define remote build caches
(such as S3 buckets) to provide a persistent, shared cache across builds and
machines.

Keep in mind that when performing builds in containers in Linux (the default
behavior), the local filesystem is local to the container and does not survive
the build of a single package. So sccache is practically meaningless unless
configured to use an external store (such as S3).

When using remote stores (such as S3), ``sccache`` can be constrained on
network I/O. We recommend having at least a 100mbps network connection to
a remote store and employing a network store with as little latency as possible
for best results.
11 changes: 0 additions & 11 deletions pythonbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,17 +570,6 @@ def add_env_common(env):
except FileNotFoundError:
pass

# Proxy sccache settings.
for k, v in os.environ.items():
if k.startswith("SCCACHE_"):
env[k] = v

# Proxy cloud provider credentials variables to enable sccache to
# use stores in those providers.
for k in ("AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"):
if k in os.environ:
env[k] = os.environ[k]


def exec_and_log(args, cwd, env):
p = subprocess.Popen(
Expand Down
2 changes: 1 addition & 1 deletion src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
for artifact in artifacts {
if matches!(
artifact.name.as_str(),
"pythonbuild" | "sccache" | "toolchain"
"pythonbuild" | "toolchain"
) || artifact.name.contains("install-only")
{
continue;
Expand Down