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

Require scie-pants 0.9.2 or newer, for new distribution model #19654

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions src/python/pants/bin/pants_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from dataclasses import dataclass
from typing import List, Mapping

from packaging.version import Version

from pants.base.deprecated import warn_or_error
from pants.base.exception_sink import ExceptionSink
from pants.base.exiter import ExitCode
from pants.engine.env_vars import CompleteEnvironmentVars
Expand All @@ -20,6 +23,10 @@

logger = logging.getLogger(__name__)

# Pants 2.18 is using a new distribution model, that's only supported in 0.9.0 (this is 0.9.2,
# because _detecting_ the version is only supported from 0.9.2), so people should upgrade
MINIMUM_SCIE_PANTS_VERSION = Version("0.9.2")


@dataclass(frozen=True)
class PantsRunner:
Expand Down Expand Up @@ -90,6 +97,26 @@ def run(self, start_time: float) -> ExitCode:
),
)

scie_pants_version = os.environ.get("SCIE_PANTS_VERSION")
if (
scie_pants_version is None
or Version(scie_pants_version) < MINIMUM_SCIE_PANTS_VERSION
):
current_version_text = (
f"The current version of the `pants` launcher binary is {scie_pants_version}"
if scie_pants_version
else f"Run `PANTS_BOOTSTRAP_VERSION=report pants` to see the current version of the `pants` launcher binary"
)
warn_or_error(
"2.18.0.dev6",
f"using a `pants` launcher binary older than {MINIMUM_SCIE_PANTS_VERSION}",
softwrap(
f"""
{current_version_text}, and see {doc_url("installation")} for how to upgrade.
"""
),
)

# N.B. We inline imports to speed up the python thin client run, and avoids importing
# engine types until after the runner has had a chance to set __PANTS_BIN_NAME.
if self._should_run_with_pantsd(global_bootstrap_options):
Expand Down
Loading