From a35d4d368a21f4b70afa3195da4d6292a649cb4c Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 7 May 2023 01:21:18 -0400 Subject: [PATCH] ciimage: fix pathological brokenness in homebrew packaging of python Followup to commit 5c479d7a13a518c18ccb4dc3b6bdd7bfc2a9bdb5. In this case, PEP 668 was created to allow a thing that Debian wanted, which is for `pip install foobar` to not break the system python. This despite the fact that the system python is fine, unless you use sudo pip which is discouraged for separate reasons, and it is in fact quite natural to install additional packages to the user site-packages. It isn't even the job of the operating system to decide whether the user site-packages is broken, whether the operating system gets the answer correct or not -- it is the job of the operating system to decide whether the operating system is broken, and that can be solved by e.g. enforcing a shebang policy for distribution-packaged software, which distros like Fedora do, and mandating not only that python shebangs do not contain `/usr/bin/env`, but that they *do* contain -s. Anyway, this entire kerfuffle is mostly just a bit of pointless interactive churn, but it bites pretty hard for our use case, which is a container image, so instead of failing to run because of theoretical conflicts with the base system (we specifically need base system integration...) we fail to run because 5 minutes into pulling homebrew updates at the very beginning, pip refuses point-blank to work. I especially do not know why it is the job of the operating system to throw errors intended for interactive users at people designing system integration containers who cannot "break" the system python anyway as it is thrown away after every use. Fix this by doing what homebrew should have done from the beginning, and opting containers out of this questionable feature entirely. --- .github/workflows/macos.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 236b9792d..cd58f9d45 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -90,6 +90,10 @@ jobs: find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete sudo rm -rf /Library/Frameworks/Python.framework/ brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3 + # Delete nonsensical PEP 668 breakage. It is the wrong solution to the problem and isn't designed to be + # productive -- only victim blaming -- however it bites particularly badly because this is a container/VM + # See commit 5c479d7a13a518c18ccb4dc3b6bdd7bfc2a9bdb5 for a more thorough analysis. + find /usr/local/Cellar/python* -name EXTERNALLY-MANAGED -print0 | xargs -0 rm -vf # use python3 from homebrew because it is a valid framework, unlike the actions one: # https://github.com/actions/setup-python/issues/58 - run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc