| #!/bin/bash | |
| # Copyright 2026 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| #### CATEGORY=Build | |
| #### PREBUILTS=${PREBUILT_PYTHON3} | |
| ### turn the Python build forkserver on or off | |
| ## usage: fx build-forkserver <enable|disable|status> | |
| ## | |
| ## enable Run Python build actions on a per-build forkserver. | |
| ## disable Run each Python build action in its own interpreter (default). | |
| ## status Show whether the forkserver is on for this checkout. | |
| ## | |
| ## The setting applies to every build directory of the checkout. enable and | |
| ## disable regenerate the current build directory (fx gen), so the next build | |
| ## uses the new setting. Another build directory picks it up when it next | |
| ## regenerates; run `fx --dir DIR gen` to apply it there right away. | |
| ## | |
| ## See //build/scripts/python_forkserver/README.md. | |
| set -e | |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $? | |
| fx-standard-switches "$@" | |
| set -- "${FX_ARGV[@]}" | |
| # Exports FUCHSIA_BUILD_DIR if there is a build directory. | |
| fx-build-dir-if-present || true | |
| # fx puts the prebuilt python3 from PREBUILTS above first on PATH. | |
| PYTHONPATH="${FUCHSIA_DIR}" exec python3 -S \ | |
| "${FUCHSIA_DIR}/tools/devshell/build_forkserver.py" "$@" |