Merge pull request #18128 from cho-m/python-avoid-modifying-all-links

This commit is contained in:
Mike McQuaid 2024-08-23 08:07:45 +01:00 committed by GitHub
commit d1e0c078bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -330,8 +330,9 @@ module Language
# Robustify symlinks to survive python patch upgrades # Robustify symlinks to survive python patch upgrades
@venv_root.find do |f| @venv_root.find do |f|
next unless f.symlink? next unless f.symlink?
next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR next unless f.readlink.expand_path.to_s.start_with? HOMEBREW_CELLAR
rp = f.realpath.to_s
version = rp.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/}o version = rp.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/}o
version = "@#{version.captures.first}" unless version.nil? version = "@#{version.captures.first}" unless version.nil?