ruby-changes:58005
From: Nobuyoshi <ko1@a...>
Date: Sun, 29 Sep 2019 18:53:36 +0900 (JST)
Subject: [ruby-changes:58005] f10c9cb1f2 (master): [ruby/zlib] Search zlib.c as a gem
https://git.ruby-lang.org/ruby.git/commit/?id=f10c9cb1f2 From f10c9cb1f2dfca024937bc48137168124d8511aa Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 29 Sep 2019 18:21:17 +0900 Subject: [ruby/zlib] Search zlib.c as a gem https://github.com/ruby/zlib/commit/8f43b264cd diff --git a/ext/zlib/zlib.gemspec b/ext/zlib/zlib.gemspec index f5b6443..4a77ae3 100644 --- a/ext/zlib/zlib.gemspec +++ b/ext/zlib/zlib.gemspec @@ -1,9 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ext/zlib/zlib.gemspec#L1 # coding: utf-8 # frozen_string_literal: true -source_version = File.open(File.join(__dir__, "zlib.c")) {|f| - f.gets("\n#define RUBY_ZLIB_VERSION ") - f.gets[/\s*(".+")/, 1].undump -} + +source_version = ["", "ext/zlib/"].find do |dir| + begin + break File.open(File.join(__dir__, "#{dir}zlib.c")) {|f| + f.gets("\n#define RUBY_ZLIB_VERSION ") + f.gets[/\s*"(.+)"/, 1] + } + rescue Errno::ENOENT + end +end + Gem::Specification.new do |spec| spec.name = "zlib" spec.version = source_version -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/