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

cleaner: remove pip direct_url.json #16853

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Library/Homebrew/cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
end

rewrite_shebangs
remove_pip_direct_url

prune
end
Expand Down Expand Up @@ -163,6 +164,28 @@
end
end
end

# Remove non-reproducible pip direct_url.json which records the /tmp build directory
sig { void }
def remove_pip_direct_url
basepath = @formula.prefix.realpath
basepath.find do |path|
Find.prune if @formula.skip_clean?(path)

next if path.directory? || path.symlink?
next if path.basename.to_s != "direct_url.json"
next if path.parent.extname != ".dist-info"

odebug "Removing #{path}"
path.unlink

Check warning on line 180 in Library/Homebrew/cleaner.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cleaner.rb#L179-L180

Added lines #L179 - L180 were not covered by tests

record = path.parent/"RECORD"

Check warning on line 182 in Library/Homebrew/cleaner.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cleaner.rb#L182

Added line #L182 was not covered by tests
next unless record.file?

odebug "Modifying #{record}"
@formula.inreplace record, %r{^.*/direct_url\.json,.*$\n?}, "", false

Check warning on line 186 in Library/Homebrew/cleaner.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cleaner.rb#L185-L186

Added lines #L185 - L186 were not covered by tests
end
end
end

require "extend/os/cleaner"