ruby-changes:73590
From: Nobuyoshi <ko1@a...>
Date: Sat, 17 Sep 2022 16:35:18 +0900 (JST)
Subject: [ruby-changes:73590] 76c0056505 (master): Follow emoji data files header change
https://git.ruby-lang.org/ruby.git/commit/?id=76c0056505 From 76c00565052368f693bc4e18e8e40b614f744d74 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 14 Sep 2022 18:03:48 +0900 Subject: Follow emoji data files header change The header of emoji data files in UCD, which were moved at 13.0.0, has been changed since 14.0.0. It seems to be the same as other files in UCD. --- tool/enc-unicode.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb index 93f6e869f8..6fb0f36d5b 100755 --- a/tool/enc-unicode.rb +++ b/tool/enc-unicode.rb @@ -311,18 +311,19 @@ end https://github.com/ruby/ruby/blob/trunk/tool/enc-unicode.rb#L311 def data_foreach(name, &block) fn = get_file(name) warn "Reading #{name}" - if /^emoji/ =~ name - sep = "" - pat = /^# #{Regexp.quote(File.basename(name))}.*^# Version: ([\d.]+)/m - type = :Emoji - else - sep = "\n" - pat = /^# #{File.basename(name).sub(/\./, '-([\\d.]+)\\.')}/ - type = :Unicode - end File.open(fn, 'rb') do |f| - line = f.gets(sep) - unless version = line[pat, 1] + if /^emoji/ =~ name + line = f.gets("") + # Headers till Emoji 13 + version = line[/^# #{Regexp.quote(File.basename(name))}.*^# Version: ([\d.]+)/m, 1] + type = :Emoji + else + # Headers since Emoji 14 or other Unicode data + line = f.gets("\n") + type = :Unicode + end + version ||= line[/^# #{File.basename(name).sub(/\./, '-([\\d.]+)\\.')}/, 1] + unless version raise ArgumentError, <<-ERROR #{name}: no #{type} version #{line.gsub(/^/, '> ')} @@ -330,7 +331,7 @@ def data_foreach(name, &block) https://github.com/ruby/ruby/blob/trunk/tool/enc-unicode.rb#L331 end if !(v = $versions[type]) $versions[type] = version - elsif v != version + elsif v != version and "#{v}.0" != version raise ArgumentError, <<-ERROR #{name}: #{type} version mismatch: #{version} to #{v} #{line.gsub(/^/, '> ')} -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/