[rubygems/rubygems] Remove shellwords autoload
https://github.com/rubygems/rubygems/commit/2af1646776
This commit is contained in:
parent
db66038285
commit
6f336d1b15
@ -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)
|
||||
make_program = shellsplit(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)
|
||||
cmd = shellsplit(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)
|
||||
results << shelljoin(command)
|
||||
|
||||
require "open3"
|
||||
# Set $SOURCE_DATE_EPOCH for the subprocess.
|
||||
@ -127,6 +126,18 @@ class Gem::Ext::Builder
|
||||
end
|
||||
end
|
||||
|
||||
def self.shellsplit(command)
|
||||
require "shellwords"
|
||||
|
||||
Shellwords.split(command)
|
||||
end
|
||||
|
||||
def self.shelljoin(command)
|
||||
require "shellwords"
|
||||
|
||||
Shellwords.join(command)
|
||||
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"))
|
||||
cc_flag = self.class.shellsplit(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 = self.class.shellsplit(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, ""))
|
||||
self.class.shellsplit(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)
|
||||
rake = shellsplit(rake)
|
||||
else
|
||||
begin
|
||||
rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
|
||||
|
@ -1,3 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
autoload :Shellwords, "shellwords"
|
Loading…
x
Reference in New Issue
Block a user