Merge pull request #16853 from cho-m/cleaner-direct_url.json

cleaner: remove pip direct_url.json
This commit is contained in:
Mike McQuaid 2024-03-08 08:25:44 +00:00 committed by GitHub
commit 8cce987f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"