mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cleaner: remove pip direct_url.json
Signed-off-by: Michael Cho <michael@michaelcho.dev>
This commit is contained in:
parent
3d948b7803
commit
4b5bcd39fd
@ -58,6 +58,7 @@ class Cleaner
|
||||
end
|
||||
|
||||
rewrite_shebangs
|
||||
remove_pip_direct_url
|
||||
|
||||
prune
|
||||
end
|
||||
@ -163,6 +164,28 @@ class Cleaner
|
||||
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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user