gh-141081: Don't create .gitignore in site-packages#142745
gh-141081: Don't create .gitignore in site-packages#142745hugovk wants to merge 1 commit intopython:mainfrom
Conversation
…age installers, not Git
|
!buildbot AMD64 |
|
🤖 New build scheduled with the buildbot fleet by @hugovk for commit 6686ca6 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142745%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
|
!buildbot PPC64LE Fedora Stable |
|
🤖 New build scheduled with the buildbot fleet by @hugovk for commit 6686ca6 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142745%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
|
!buildbot x86-64 macOS |
|
🤖 New build scheduled with the buildbot fleet by @hugovk for commit 6686ca6 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142745%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
| gitignore_content = b'# Created by CPython\n*\n' | ||
| # Don't create in site-packages as these are managed | ||
| # by package installers, not Git | ||
| if 'site-packages' not in parent: |
There was a problem hiding this comment.
Doesn't this assume that sysconfig.get_path('purelib') is named site-packages?
Users can configure this in site.py; Ubuntu uses dist-packages instead.
There was a problem hiding this comment.
It does, let's change to use sysconfig.get_path('purelib'). Should we also check sysconfig.get_path('platlib')?
- platlib: directory for site-specific, platform-specific files.
- purelib: directory for site-specific, non-platform-specific files (‘pure’ Python).
https://docs.python.org/3/library/sysconfig.html#installation-paths
There was a problem hiding this comment.
Maybe?
More generally: how can you tell what “manages” a given directory? I don't really have an answer, I'm afraid.
|
Closing, the original PR has been reverted for now, let's continue in the issue. |
The buildbot failures:
The problem was that when pip uninstalls itself, it removes its own files, and then tries to remove empty directories like
__pycache__. But__pycache__contains our.gitignoreso the dir removal fails.Instead, let's not add
.gitignoreinsite-packagesdirs, and let the package managers handle those.Debian and Ubuntu use
dist-packagesrather thansite-packages-- should we include that as well?