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

Pass --python-repos-find-links always, and deprecate PANTS_SHA #250

Merged
merged 4 commits into from
Aug 25, 2023

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Aug 25, 2023

Currently, the scie-pants launcher sometimes needs to pass an additional argument to the underlying pants invocation, to be able to support PANTS_SHA and its custom wheel location. Effectively turning an invocation like pants goal --arg into pants --pants-repos-find-links=+["..."] goal --arg when appropriate:

exe = "{scie.bindings.install:PANTS_CLIENT_EXE}"
args = [
"{scie.bindings.configure:PANTS_SHA_FIND_LINKS}",
]

However, when not using PANTS_SHA, the pants command becomes pants "" goal --arg, and the spurious empty string results in some commands failing, e.g. pants "" tailor --check thinks --check is a global argument, and this is ambiguous.

To fix this issue, this PR does two things:

  1. avoid passing an empty string, via a no-op workaround: always set the PANTS_SHA_FIND_LINKS variable (to a no-op like --python-repos-find-links=-[]), so that scie-pants never passes an empty variable to the pants command, since that makes commands like pants tailor --check :: explode:
  2. deprecates PANTS_SHA, so that the hack above doesn't feel so bad: we're on the way to removing the need for PANTS_SHA_FIND_LINKS entirely, thus sidestepping the limitation and the need for the workaround (2)

This could also be fixed via a-scie/jump#130.

Fixes #249

@huonw huonw changed the title Pass --python-repos-find-links always, stopping empty string confusion Pass --python-repos-find-links always, and deprecate PANTS_SHA Aug 25, 2023
@huonw huonw marked this pull request as ready for review August 25, 2023 04:59
@huonw
Copy link
Contributor Author

huonw commented Aug 25, 2023

Just noting some manual testing:

I've confirmed the execve syscall in the same way as #249 (comment):

[
  "/root/.cache/nce/0de4b72a5e712632a9421fa33e3c3c0e072a2b7ed9babda918e01bd01164cdbc/bindings/venvs/2.18.0.dev5/bin/pants",
  "--python-repos-find-links=-[]",
  "--no-pantsd",
  "tailor",
  "--check",
  "::"
]

This doesn't seem to interfere with additional manual instances of that arg, e.g. PANTS_PYTHON_REPOS_FIND_LINKS='+["abc"]' ./scie-pants-linux-aarch64 --python-repos-find-links='+["def"]' help-advanced python-repos says:

  --python-repos-find-links="['<str>', '<str>', ...]"
  PANTS_PYTHON_REPOS_FIND_LINKS
  find_links
      default: []
      current value: [
          "abc",
          "def"
      ] (from env var PANTS_PYTHON_REPOS_FIND_LINKS, from command-line flag)

@huonw huonw merged commit 7dd7e79 into pantsbuild:main Aug 25, 2023
5 checks passed
@huonw huonw deleted the bugfix/249-empty-arg branch August 25, 2023 06:11
@thejcannon
Copy link
Member

thejcannon commented Aug 25, 2023

Clever, but in the "we need to get unblocked" way 👍

@thejcannon
Copy link
Member

Also, does this mean we should bump the version number of scie-pants we check for, and cherry pick to 2.17.x?

😬

@thejcannon
Copy link
Member

Also, does this mean we should bump the version number of scie-pants we check for, and cherry pick to 2.17.x?

😬

pantsbuild/pants#19670

thejcannon added a commit to pantsbuild/pants that referenced this pull request Aug 25, 2023
github-actions bot pushed a commit to pantsbuild/pants that referenced this pull request Aug 25, 2023
thejcannon added a commit to pantsbuild/pants that referenced this pull request Aug 25, 2023
See pantsbuild/scie-pants#250 for the required
fix.

Co-authored-by: Josh Cannon <joshdcannon@gmail.com>
github-actions bot pushed a commit to pantsbuild/pants that referenced this pull request Aug 29, 2023
huonw pushed a commit to pantsbuild/pants that referenced this pull request Aug 29, 2023
See pantsbuild/scie-pants#250 for the required
fix.

Co-authored-by: Josh Cannon <joshdcannon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pants tailor --check :: fails with Unknown flag --check on global scope with new PEX distribution mechanism
3 participants