Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[internal] note dependency to scie-pants on "testing" env vars. #18170

Merged
merged 3 commits into from
Feb 4, 2023
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
7 changes: 4 additions & 3 deletions src/python/pants/base/build_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class BuildRoot(metaclass=SingletonMetaclass):
"""Represents the global workspace build root.

By default a Pants workspace is defined by a root directory where one of multiple sentinel files
reside, such as `pants` or `BUILD_ROOT`. This path can also be manipulated through this
reside, such as `pants.toml` or `BUILD_ROOT`. This path can also be manipulated through this
interface for re-location of the build root in tests.
"""

sentinel_files = ["pants", "BUILDROOT", "BUILD_ROOT"]
sentinel_files = ["pants.toml", "pants", "BUILDROOT", "BUILD_ROOT"]

class NotFoundError(Exception):
"""Raised when unable to find the current workspace build root."""
Expand Down Expand Up @@ -46,7 +46,8 @@ def pathlib_path(self) -> Path:
def path(self) -> str:
"""Returns the build root for the current workspace."""
if self._root_dir is None:
# This env variable is for testing purpose.
# Do not remove/change this env var without coordinating with `pantsbuild/scie-pants` as
# it is being used when bootstrapping Pants.
override_buildroot = os.environ.get("PANTS_BUILDROOT_OVERRIDE", None)
if override_buildroot:
self._root_dir = override_buildroot
Expand Down
3 changes: 3 additions & 0 deletions src/python/pants/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
from pants.util.resources import read_resource

# Set this env var to override the version pants reports. Useful for testing.
# Do not change. (see below)
_PANTS_VERSION_OVERRIDE = "_PANTS_VERSION_OVERRIDE"


VERSION: str = (
# Do not remove/change this env var without coordinating with `pantsbuild/scie-pants` as it is
# being used when bootstrapping Pants with a released version.
os.environ.get(_PANTS_VERSION_OVERRIDE)
or
# NB: We expect VERSION to always have an entry and want a runtime failure if this is false.
Expand Down