Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore #110108

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

Merged
merged 3 commits into from
Sep 29, 2023

Conversation

zooba
Copy link
Member

@zooba zooba commented Sep 29, 2023

@vstinner
Copy link
Member

I didn't expect that finding the location of the Python source code and checking if it's actually available or not would be so complicated!

At least, it's good, we are finding and fixing issues :-)

For now, I'm ok to keep the code in test_support.py, but later we might share more code in support\__init__.py.

test_freeze and test_venv copy the stdlib. test_venv only cares about Python code, whereas test_freeze wants the C code.

@vstinner
Copy link
Member

The last change makes test_copy_python_src_ignore fail rather than skip on Windows installs,

Oh. How did you notice that? Is Azure Pipelines running tests which such use cases, or did you discover the issue manually?

@zooba zooba requested a review from a team as a code owner September 29, 2023 14:13
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR now includes unrelated change. Is it on purpose?

@zooba
Copy link
Member Author

zooba commented Sep 29, 2023

I didn't expect that finding the location of the Python source code and checking if it's actually available or not would be so complicated!

Yeah, there's a reason I listed this on my wishlist for a new build system. Would be great if we just always built an install-like layout, rather than trying to intermingle it with the source tree.

The pybuilddir.txt file should always be there in a build, even on Windows, adjacent to the main executable (approximately, os.path.realpath(sys.orig_argv[0])). The official check is in getpath.py, and it sets the _is_python_build config value. I forget where that ends up precisely.

@zooba
Copy link
Member Author

zooba commented Sep 29, 2023

Your PR now includes unrelated change.

Nope. That's what I get for trying to fix OpenSSL stuff 😆

@zooba
Copy link
Member Author

zooba commented Sep 29, 2023

Oh. How did you notice that? Is Azure Pipelines running tests which such use cases, or did you discover the issue manually?

It should, but they seem to have been passing for some reason. I haven't looked closely, but possibly they got disabled recently because people want to move to GHA.

I also run my own daily tests at work, and it was found in the "layout test", which generates an install layout (python PC/layout --preset-default --copy <DIR>), copies it to a brand new machine, and then runs the test suite. That was where I noticed it first.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zooba zooba merged commit 20bc5f7 into python:main Sep 29, 2023
@miss-islington
Copy link
Contributor

Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@zooba zooba deleted the gh-109615 branch September 29, 2023 15:24
@miss-islington
Copy link
Contributor

Sorry, @zooba, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 20bc5f7c28a6f8a2e156c4a748ffabb5efc7c761 3.12

@bedevere-app
Copy link

bedevere-app bot commented Sep 29, 2023

GH-110110 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Sep 29, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 29, 2023
…src_ignore (pythonGH-110108)

(cherry picked from commit 20bc5f7)

Co-authored-by: Steve Dower <[email protected]>
@zooba
Copy link
Member Author

zooba commented Sep 29, 2023

I'm guessing 3.12 has conflicts because the earlier PRs haven't been merged yet? I'll wait until that's done and then trigger it again

@vstinner
Copy link
Member

Sorry, @zooba, I could not cleanly backport this to 3.12 due to a conflict.

Last days, I gave up on backports since 3.12 is blocked. I plan to try to backport my Tests and Docs changes once 3.12 will be reopened again next week. Until that, it's a backport nightmare :-(

zooba added a commit that referenced this pull request Sep 29, 2023
vstinner pushed a commit to vstinner/cpython that referenced this pull request Oct 4, 2023
vstinner added a commit that referenced this pull request Oct 4, 2023
…#110340)

* gh-109615: Fix support test_copy_python_src_ignore() (#109958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".

(cherry picked from commit b89ed9d)

* gh-109615: Fix support test_copy_python_src_ignore() on WASM (#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.

(cherry picked from commit cc54bcf)

* gh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore (GH-110108)

(cherry picked from commit 20bc5f7)

* gh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)

Call also copy_python_src_ignore() on listdir() names.

shutil.copytree(): replace set() with an empty tuple. An empty tuple
becomes a constant in the compiler and checking if an item is in an
empty tuple is cheap.

(cherry picked from commit 0def8c7)

---------

Co-authored-by: Steve Dower <[email protected]>
@vstinner vstinner added needs backport to 3.12 only security fixes and removed needs backport to 3.12 only security fixes labels Oct 17, 2023
@miss-islington-app
Copy link

Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @zooba, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 20bc5f7c28a6f8a2e156c4a748ffabb5efc7c761 3.12

@vstinner
Copy link
Member

Ah, this fix was backported to 3.12 as part of larger backport: commit 80f9585.

@vstinner vstinner removed the needs backport to 3.12 only security fixes label Oct 18, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants