bottle: delete .pyo files as with .pyc (#382)
This should make more bottles relocatable e.g. ansible. .pyo files are bytecode as .pyc files but optimized - [ref](https://www.python.org/dev/peps/pep-0488/) Ref https://github.com/Homebrew/homebrew-core/pull/2125#issuecomment-226987124
This commit is contained in:
parent
29bfc4caa3
commit
c6022104f9
@ -396,7 +396,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
def delete_pyc_files!
|
def delete_pyc_files!
|
||||||
find { |pn| pn.delete if pn.extname == ".pyc" }
|
find { |pn| pn.delete if %w[.pyc .pyo].include?(pn.extname) }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -483,9 +483,10 @@ class Keg
|
|||||||
if src.symlink? || src.file?
|
if src.symlink? || src.file?
|
||||||
Find.prune if File.basename(src) == ".DS_Store"
|
Find.prune if File.basename(src) == ".DS_Store"
|
||||||
Find.prune if src.realpath == dst
|
Find.prune if src.realpath == dst
|
||||||
# Don't link pyc files because Python overwrites these cached object
|
# Don't link pyc or pyo files because Python overwrites these
|
||||||
# files and next time brew wants to link, the pyc file is in the way.
|
# cached object files and next time brew wants to link, the
|
||||||
if src.extname == ".pyc" && src.to_s =~ /site-packages/
|
# file is in the way.
|
||||||
|
if %w[.pyc .pyo].include?(src.extname) && src.to_s.include?("/site-packages/")
|
||||||
Find.prune
|
Find.prune
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user