Skip to content

Commit

Permalink
Merge pull request #16853 from cho-m/cleaner-direct_url.json
Browse files Browse the repository at this point in the history
cleaner: remove pip direct_url.json
  • Loading branch information
MikeMcQuaid authored Mar 8, 2024
2 parents b70884a + 4b5bcd3 commit 8cce987
Showing 1 changed file with 23 additions and 0 deletions.
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 @@ def clean
end

rewrite_shebangs
remove_pip_direct_url

prune
end
Expand Down Expand Up @@ -163,6 +164,28 @@ def rewrite_shebangs
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

record = path.parent/"RECORD"
next unless record.file?

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

require "extend/os/cleaner"

0 comments on commit 8cce987

Please sign in to comment.