summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-04-10 16:42:34 +0200
committerHiroshi SHIBATA <[email protected]>2025-04-25 11:12:03 +0900
commit6f336d1b154e608d5200bd8de484737ed3f8bda6 ()
tree7a4b3e403a3426d8fd23a109e75b33ddb2e7a6e2 /lib
parentdb660382858da75c475b679799a596a330181e4d (diff)
[rubygems/rubygems] Remove shellwords autoload
https://.com/rubygems/rubygems/commit/2af1646776
-rw-r--r--lib/rubygems/ext/builder.rb19
-rw-r--r--lib/rubygems/ext/cargo_builder.rb8
-rw-r--r--lib/rubygems/ext/rake_builder.rb4
-rw-r--r--lib/rubygems/shellwords.rb3
4 files changed, 19 insertions, 15 deletions
@@ -7,7 +7,6 @@
#++
require_relative "../user_interaction"
-require_relative "../shellwords"
class Gem::Ext::Builder
include Gem::UserInteraction
@@ -29,7 +28,7 @@ class Gem::Ext::Builder
target_rbconfig["configure_args"] =~ /with-make-prog\=(\w+)/
make_program_name = ENV["MAKE"] || ENV["make"] || $1
make_program_name ||= RUBY_PLATFORM.include?("mswin") ? "nmake" : "make"
- make_program = Shellwords.split(make_program_name)
# The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
destdir = /\bnmake/i !~ make_program_name || ENV["DESTDIR"] && ENV["DESTDIR"] != "" ? format("DESTDIR=%s", ENV["DESTDIR"]) : ""
@@ -58,7 +57,7 @@ class Gem::Ext::Builder
def self.ruby
# Gem.ruby is quoted if it contains whitespace
- cmd = Shellwords.split(Gem.ruby)
# This load_path is only needed when running rubygems test without a proper installation.
# Prepending it in a normal installation will cause problem with order of $LOAD_PATH.
@@ -83,7 +82,7 @@ class Gem::Ext::Builder
p(command)
end
results << "current directory: #{dir}"
- results << Shellwords.join(command)
require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess.
@@ -127,6 +126,18 @@ class Gem::Ext::Builder
end
end
##
# Creates a new extension builder for +spec+. If the +spec+ does not yet
# have build arguments, saved, set +build_args+ which is an ARGV-style
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative "../shellwords"
-
# This class is used by rubygems to build Rust extensions. It is a thin-wrapper
# over the `cargo rustc` command which takes care of building Rust code in a way
# that Ruby can use.
@@ -159,7 +157,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
# We want to use the same linker that Ruby uses, so that the linker flags from
# mkmf work properly.
def linker_args
- cc_flag = Shellwords.split(makefile_config("CC"))
linker = cc_flag.shift
link_args = cc_flag.flat_map {|a| ["-C", "link-arg=#{a}"] }
@@ -178,7 +176,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def libruby_args(dest_dir)
libs = makefile_config(ruby_static? ? "LIBRUBYARG_STATIC" : "LIBRUBYARG_SHARED")
- raw_libs = Shellwords.split(libs)
raw_libs.flat_map {|l| ldflag_to_link_modifier(l) }
end
@@ -261,7 +259,7 @@ EOF
end
def split_flags(var)
- Shellwords.split(RbConfig::CONFIG.fetch(var, ""))
end
def ldflag_to_link_modifier(arg)
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative "../shellwords"
-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -22,7 +20,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
rake = ENV["rake"]
if rake
- rake = Shellwords.split(rake)
else
begin
rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
@@ -1,3 +0,0 @@
-# frozen_string_literal: true
-
-autoload :Shellwords, "shellwords"