summaryrefslogtreecommitdiff
path: root/spec/default.mspec
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-10-18 10:13:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-10-18 11:43:50 +0900
commite1e3657746b935e8c9ab6f4beccd0aaed45db9dc (patch)
tree74a7f47965ad6c58c76eb5ec002d22a4d1633406 /spec/default.mspec
parent0381d10533b5d51a075b0c6505e63bad60c9d1c9 (diff)
downloadruby-e1e3657746b935e8c9ab6f4beccd0aaed45db9dc.tar.gz
Simplify srcdir fallback
Diffstat (limited to 'spec/default.mspec')
-rw-r--r--spec/default.mspec6
1 files changed, 1 insertions, 5 deletions
diff --git a/spec/default.mspec b/spec/default.mspec
index 8791058f95..162fa8b9f2 100644
--- a/spec/default.mspec
+++ b/spec/default.mspec
@@ -9,11 +9,7 @@ OBJDIR = File.expand_path("spec/ruby/optional/capi/ext")
class MSpecScript
builddir = Dir.pwd
srcdir = ENV['SRCDIR']
- if !srcdir and File.exist?("#{builddir}/Makefile") then
- File.open("#{builddir}/Makefile", "r:US-ASCII") {|f|
- f.read[/^\s*srcdir\s*=\s*(.+)/i] and srcdir = $1
- }
- end
+ srcdir ||= File.read("Makefile", encoding: "US-ASCII")[/^\s*srcdir\s*=\s*(.+)/i, 1] rescue nil
srcdir = File.expand_path(srcdir)
config = RbConfig::CONFIG