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

Fix running python_sources with pex --executable #21047

Merged
merged 7 commits into from
Jun 18, 2024

Conversation

cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Jun 11, 2024

This fixes the feature added in #20497 as it broke using pants run on a python_source if the file name has - or other invalid characters. Bug reported here:
https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested running pex_binary, not python_source. So, I missed applying some of the path logic to both cases.

@cognifloyd cognifloyd added category:bugfix Bug fixes for released features backend: Python Python backend-related issues labels Jun 11, 2024
@cognifloyd cognifloyd self-assigned this Jun 11, 2024
@cognifloyd cognifloyd added this to the 2.20.x milestone Jun 11, 2024
The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
Pex requires the --executable file to be present in the sandbox
so that it can be embedded in the pex file.

So, even if include_source_files is False, include the source file for
the Executable main.
The executable source should always get explicitly added to dependencies
because there is no dep inference for the pex_binary(executable=) field.

So, we only need to look up the source and include it if the other sources
are not already going to be in the sandbox.
we do not know the target name, so if it is not in the default target,
running this might result in errors.
OwnersRequest, however, takes the file and matches it to any targets.
@cognifloyd cognifloyd force-pushed the cognifloyd/fix-pex-exe branch from 02407a9 to c2ef07f Compare June 17, 2024 22:26
@cognifloyd cognifloyd marked this pull request as ready for review June 17, 2024 22:31
@cognifloyd cognifloyd requested review from kaos, benjyw and tdyas June 17, 2024 22:39
@cognifloyd cognifloyd merged commit 7970d30 into main Jun 18, 2024
25 checks passed
@cognifloyd cognifloyd deleted the cognifloyd/fix-pex-exe branch June 18, 2024 18:03
@WorkerPants
Copy link
Member

I tried to automatically cherry-pick this change back to each relevant milestone, so that it is available in those older releases of Pants.

❌ 2.20.x

I was unable to cherry-pick this PR to 2.20.x, likely due to merge-conflicts.

Steps to Cherry-Pick locally

To resolve:

  1. (Ensure your git working directory is clean)
  2. Run the following script to reproduce the merge-conflicts:
    git fetch https://github.com/pantsbuild/pants main \
      && git fetch https://github.com/pantsbuild/pants 2.20.x \
      && git checkout -b cherry-pick-21047-to-2.20.x FETCH_HEAD \
      && git cherry-pick 7970d308719df22b2cb483e950fc64b0315a4242
  3. Fix the merge conflicts and commit the changes
  4. Run build-support/cherry_pick/make_pr.sh "21047" "2.20.x"

Please note that I cannot re-run CI if a job fails. Please work with your PR approver(s) to re-run CI if necessary.

❌ 2.21.x

I was unable to cherry-pick this PR to 2.21.x, likely due to merge-conflicts.

Steps to Cherry-Pick locally

To resolve:

  1. (Ensure your git working directory is clean)
  2. Run the following script to reproduce the merge-conflicts:
    git fetch https://github.com/pantsbuild/pants main \
      && git fetch https://github.com/pantsbuild/pants 2.21.x \
      && git checkout -b cherry-pick-21047-to-2.21.x FETCH_HEAD \
      && git cherry-pick 7970d308719df22b2cb483e950fc64b0315a4242
  3. Fix the merge conflicts and commit the changes
  4. Run build-support/cherry_pick/make_pr.sh "21047" "2.21.x"

Please note that I cannot re-run CI if a job fails. Please work with your PR approver(s) to re-run CI if necessary.

❌ 2.22.x

I was unable to cherry-pick this PR to 2.22.x, likely due to merge-conflicts.

Steps to Cherry-Pick locally

To resolve:

  1. (Ensure your git working directory is clean)
  2. Run the following script to reproduce the merge-conflicts:
    git fetch https://github.com/pantsbuild/pants main \
      && git fetch https://github.com/pantsbuild/pants 2.22.x \
      && git checkout -b cherry-pick-21047-to-2.22.x FETCH_HEAD \
      && git cherry-pick 7970d308719df22b2cb483e950fc64b0315a4242
  3. Fix the merge conflicts and commit the changes
  4. Run build-support/cherry_pick/make_pr.sh "21047" "2.22.x"

Please note that I cannot re-run CI if a job fails. Please work with your PR approver(s) to re-run CI if necessary.


When you're done manually cherry-picking, please remove the needs-cherrypick label on this PR.

Thanks again for your contributions!

🤖 Beep Boop here's my run link

@WorkerPants WorkerPants added the auto-cherry-picking-failed Auto Cherry-Picking Failed label Jun 18, 2024
cognifloyd added a commit that referenced this pull request Jun 18, 2024
This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
cognifloyd added a commit that referenced this pull request Jun 18, 2024
This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
cognifloyd added a commit that referenced this pull request Jun 18, 2024
This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
cognifloyd added a commit that referenced this pull request Jun 18, 2024
This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
cognifloyd added a commit that referenced this pull request Jun 19, 2024
…) (#21084)

This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
cognifloyd added a commit that referenced this pull request Jun 19, 2024
…) (#21085)

This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
cognifloyd added a commit that referenced this pull request Jun 19, 2024
…) (#21086)

This fixes the feature added in #20497 as it broke using `pants run` on
a python_source if the file name has `-` or other invalid characters.
Bug reported here:

https://pantsbuild.slack.com/archives/C046T6T9U/p1717624913138789?thread_ts=1717624913.138789&cid=C046T6T9U

The other integration test for the pex --executable feature only tested
running pex_binary, not python_source. So, I missed applying some of the
path logic to both cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-cherry-picking-failed Auto Cherry-Picking Failed backend: Python Python backend-related issues category:bugfix Bug fixes for released features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants