Skip to content

Commit

Permalink
Merge pull request #179164 from Homebrew/p-rubocop-no-rmrf
Browse files Browse the repository at this point in the history
p*: Fix `Homebrew/NoFileutilsRmrf` RuboCop offenses
  • Loading branch information
p-linnane committed Jul 31, 2024
2 parents 926618a + 65cd182 commit cfd076c
Show file tree
Hide file tree
Showing 23 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Formula/p/packetbeat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Packetbeat < Formula

def install
# remove non open source files
rm_rf "x-pack"
rm_r("x-pack")

cd "packetbeat" do
# prevent downloading binary wheels during python setup
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pacmc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Pacmc < Formula
depends_on "openjdk"

def install
rm_f Dir["bin/*.bat"]
rm(Dir["bin/*.bat"])
libexec.install %w[bin lib]
(bin/"pacmc").write_env_script libexec/"bin/pacmc", Language::Java.overridable_java_home_env
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pandoc-crossref.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PandocCrossref < Formula
uses_from_macos "zlib"

def install
rm_f "cabal.project.freeze"
rm("cabal.project.freeze")

system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/parrot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def install
system "make"
system "make", "install"
# Don't install this file in HOMEBREW_PREFIX/lib
rm_rf lib/"VERSION"
rm_r(lib/"VERSION")
end

test do
Expand Down
6 changes: 3 additions & 3 deletions Formula/p/passenger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def install
(libexec/"download_cache").mkpath

# Fixes https://github.com/phusion/passenger/issues/1288
rm_rf "buildout/libev"
rm_rf "buildout/libuv"
rm_rf "buildout/cache"
rm_r("buildout/libev")
rm_r("buildout/libuv")
rm_r("buildout/cache")

necessary_files = %w[configure Rakefile README.md CONTRIBUTORS
CONTRIBUTING.md LICENSE CHANGELOG package.json
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pax-construct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PaxConstruct < Formula
depends_on "maven"

def install
rm_rf Dir["bin/*.bat"]
rm_r(Dir["bin/*.bat"])
prefix.install_metafiles "bin" # Don't put these in bin!
libexec.install Dir["*"]
bin.write_exec_script Dir["#{libexec}/bin/*"].select { |f| File.executable? f }
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/payara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Payara < Formula

def install
# Remove Windows scripts
rm_f Dir["**/*.{bat,exe}"]
rm(Dir["**/*.{bat,exe}"])

inreplace "bin/asadmin", /AS_INSTALL=.*/,
"AS_INSTALL=#{libexec}/glassfish"
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pdal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def install
system "cmake", "--build", "build"
system "cmake", "--install", "build"

rm_rf "test/unit"
rm_r("test/unit")
doc.install "examples", "test"
end

Expand Down
4 changes: 2 additions & 2 deletions Formula/p/percona-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ def install
end

# Remove the tests directory
rm_rf prefix/"mysql-test"
rm_r(prefix/"mysql-test")

# Don't create databases inside of the prefix!
# See: https://github.com/Homebrew/homebrew/issues/4975
rm_rf prefix/"data"
rm_r(prefix/"data")

# Fix up the control script and link into bin.
inreplace "#{prefix}/support-files/mysql.server",
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/perkeep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def install

# Vendored version of gopherjs requires go 1.10, so use the newest available gopherjs, which
# supports newer Go versions.
rm_rf buildpath/"src/perkeep.org/vendor/github.com/gopherjs/gopherjs"
rm_r(buildpath/"src/perkeep.org/vendor/github.com/gopherjs/gopherjs")
resource("gopherjs").stage buildpath/"src/perkeep.org/vendor/github.com/gopherjs/gopherjs"

cd "src/perkeep.org" do
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/petsc-complex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def install
system "make", "install"

# Avoid references to Homebrew shims
rm_f lib/"petsc/conf/configure-hash"
rm(lib/"petsc/conf/configure-hash")

if OS.mac? || File.foreach("#{lib}/petsc/conf/petscvariables").any? { |l| l[Superenv.shims_path.to_s] }
inreplace lib/"petsc/conf/petscvariables", "#{Superenv.shims_path}/", ""
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/petsc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def install
system "make", "install"

# Avoid references to Homebrew shims
rm_f lib/"petsc/conf/configure-hash"
rm(lib/"petsc/conf/configure-hash")

if OS.mac? || File.foreach("#{lib}/petsc/conf/petscvariables").any? { |l| l[Superenv.shims_path.to_s] }
inreplace lib/"petsc/conf/petscvariables", "#{Superenv.shims_path}/", ""
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/phoronix-test-suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def install

# 7.4.0 installed files in the formula's rack so clean up the mess.
def post_install
rm_rf [prefix/"../etc", prefix/"../usr"]
rm_r([prefix/"../etc", prefix/"../usr"])
end

test do
Expand Down
4 changes: 2 additions & 2 deletions Formula/p/ppsspp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def install
# See https://github.com/Homebrew/homebrew-core/issues/84737.
cd "ffmpeg" do
if OS.mac?
rm_rf "macosx"
rm_r("macosx")
system "./mac-build.sh"
else
rm_rf "linux"
rm_r("linux")
system "./linux_x86-64.sh"
end
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/p/pypy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def post_install
# Symlink the prefix site-packages into the cellar.
unless (libexec/"site-packages").symlink?
# fix the case where libexec/site-packages/site-packages was installed
rm_rf libexec/"site-packages/site-packages"
rm_r(libexec/"site-packages/site-packages")
mv Dir[libexec/"site-packages/*"], prefix_site_packages
rm_rf libexec/"site-packages"
rm_r(libexec/"site-packages")
end
libexec.install_symlink prefix_site_packages

Expand Down
4 changes: 2 additions & 2 deletions Formula/p/pypy3.10.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def install

# Delete two files shipped which we do not want to deliver
# These files make patchelf fail
rm_f [libexec/"bin/libpypy#{abi_version}-c.so.debug", libexec/"bin/pypy#{abi_version}.debug"]
rm([libexec/"bin/libpypy#{abi_version}-c.so.debug", libexec/"bin/pypy#{abi_version}.debug"])
end

def post_install
Expand All @@ -147,7 +147,7 @@ def post_install
# Create a site-packages in the prefix.
site_packages(HOMEBREW_PREFIX).mkpath
touch site_packages(HOMEBREW_PREFIX)/".keepme"
site_packages(libexec).rmtree
rm_r(site_packages(libexec))

# Symlink the prefix site-packages into the cellar.
site_packages(libexec).parent.install_symlink site_packages(HOMEBREW_PREFIX)
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pypy3.9.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def post_install
# Create a site-packages in the prefix.
site_packages(HOMEBREW_PREFIX).mkpath
touch site_packages(HOMEBREW_PREFIX)/".keepme"
site_packages(libexec).rmtree
rm_r(site_packages(libexec))

# Symlink the prefix site-packages into the cellar.
site_packages(libexec).parent.install_symlink site_packages(HOMEBREW_PREFIX)
Expand Down
14 changes: 7 additions & 7 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def install
end

# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
rm_r(site_packages_cellar)

# Prepare a wheel of wheel to install later.
common_pip_args = %w[
Expand Down Expand Up @@ -343,16 +343,16 @@ def post_install
site_packages_cellar.parent.install_symlink site_packages

# Remove old sitecustomize.py. Now stored in the cellar.
rm_rf Dir["#{site_packages}/sitecustomize.py[co]"]
rm_r(Dir["#{site_packages}/sitecustomize.py[co]"])

# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"]
rm_rf Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
rm_rf Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"]
rm_r(Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"])
rm_r(Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"])
rm_r(Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"])
rm_r(Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"])

system python3, "-Im", "ensurepip"

Expand All @@ -377,7 +377,7 @@ def post_install
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"

rm_rf bin.glob("pip{,3}")
rm_r(bin.glob("pip{,3}"))
mv bin/"wheel", bin/"wheel#{version.major_minor}"

# Install unversioned and major-versioned symlinks in libexec/bin.
Expand Down
14 changes: 7 additions & 7 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def install
end

# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
rm_r(site_packages_cellar)

# Prepare a wheel of wheel to install later.
common_pip_args = %w[
Expand Down Expand Up @@ -346,16 +346,16 @@ def post_install
site_packages_cellar.parent.install_symlink site_packages

# Remove old sitecustomize.py. Now stored in the cellar.
rm_rf Dir["#{site_packages}/sitecustomize.py[co]"]
rm_r(Dir["#{site_packages}/sitecustomize.py[co]"])

# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"]
rm_rf Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
rm_rf Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"]
rm_r(Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"])
rm_r(Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"])
rm_r(Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"])
rm_r(Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"])

system python3, "-Im", "ensurepip"

Expand All @@ -380,7 +380,7 @@ def post_install
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"

rm_rf bin.glob("pip{,3}")
rm_r(bin.glob("pip{,3}"))
mv bin/"wheel", bin/"wheel#{version.major_minor}"

# Install unversioned and major-versioned symlinks in libexec/bin.
Expand Down
12 changes: 6 additions & 6 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def install
end

# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
rm_r(site_packages_cellar)

# Prepare a wheel of wheel to install later.
common_pip_args = %w[
Expand Down Expand Up @@ -334,15 +334,15 @@ def post_install
site_packages_cellar.parent.install_symlink site_packages

# Remove old sitecustomize.py. Now stored in the cellar.
rm_rf Dir["#{site_packages}/sitecustomize.py[co]"]
rm_r(Dir["#{site_packages}/sitecustomize.py[co]"])

# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
rm_rf Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"]
rm_r(Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"])
rm_r(Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"])
rm_r(Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"])

(lib_cellar/"EXTERNALLY-MANAGED").unlink if (lib_cellar/"EXTERNALLY-MANAGED").exist?
system python3, "-Im", "ensurepip"
Expand All @@ -367,7 +367,7 @@ def post_install
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"

rm_rf bin/"pip"
rm_r(bin/"pip")
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3"

Expand Down
12 changes: 6 additions & 6 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def install
end

# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
rm_r(site_packages_cellar)

%w[setuptools pip wheel].each do |r|
(libexec/r).install resource(r)
Expand Down Expand Up @@ -284,16 +284,16 @@ def post_install
site_packages_cellar.parent.install_symlink site_packages

# Write our sitecustomize.py
rm_rf site_packages.glob("sitecustomize.py[co]")
rm_r(site_packages.glob("sitecustomize.py[co]"))
(site_packages/"sitecustomize.py").atomic_write(sitecustomize)

# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/setuptools*"]
rm_rf Dir["#{site_packages}/distribute*"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
rm_r(Dir["#{site_packages}/setuptools*"])
rm_r(Dir["#{site_packages}/distribute*"])
rm_r(Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"])

%w[setuptools pip wheel].each do |pkg|
(libexec/pkg).cd do
Expand All @@ -305,7 +305,7 @@ def post_install
end
end

rm_rf bin.glob("{easy_install,pip{,3}}")
rm_r(bin.glob("{easy_install,pip{,3}}"))
mv bin/"wheel", bin/"wheel#{version.major_minor}"

# Install unversioned and major-versioned symlinks in libexec/bin.
Expand Down
14 changes: 7 additions & 7 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def install
end

# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
rm_r(site_packages_cellar)

# Prepare a wheel of wheel to install later.
common_pip_args = %w[
Expand Down Expand Up @@ -329,16 +329,16 @@ def post_install
site_packages_cellar.parent.install_symlink site_packages

# Remove old sitecustomize.py. Now stored in the cellar.
rm_rf Dir["#{site_packages}/sitecustomize.py[co]"]
rm_r(Dir["#{site_packages}/sitecustomize.py[co]"])

# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"]
rm_rf Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
rm_rf Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"]
rm_r(Dir["#{site_packages}/setuptools[-_.][0-9]*", "#{site_packages}/setuptools"])
rm_r(Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"])
rm_r(Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"])
rm_r(Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"])

system python3, "-Im", "ensurepip"

Expand All @@ -363,7 +363,7 @@ def post_install
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"

rm_rf bin.glob("pip{,3}")
rm_r(bin.glob("pip{,3}"))
mv bin/"wheel", bin/"wheel#{version.major_minor}"

# Install unversioned and major-versioned symlinks in libexec/bin.
Expand Down
4 changes: 2 additions & 2 deletions Formula/p/pythran.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def dprod(arr0, arr1):
return sum([x*y for x,y in zip(arr0, arr1)])
EOS
system pythran, testpath/"dprod.py"
rm_f testpath/"dprod.py"
rm(testpath/"dprod.py")

assert_equal "11", shell_output("#{python3} -c 'import dprod; print(dprod.dprod([1,2], [3,4]))'").chomp

Expand All @@ -87,7 +87,7 @@ def arc_distance(theta_1, phi_1, theta_2, phi_2):
with_env(CC: nil, CXX: nil) do
system pythran, "-DUSE_XSIMD", "-fopenmp", "-march=native", testpath/"arc_distance.py"
end
rm_f testpath/"arc_distance.py"
rm(testpath/"arc_distance.py")

system python3, "-c", <<~EOS
import numpy as np
Expand Down

0 comments on commit cfd076c

Please sign in to comment.