aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/ruby3.0_compatibility.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/ruby3.0_compatibility.patch')
-rw-r--r--debian/patches/ruby3.0_compatibility.patch75
1 files changed, 0 insertions, 75 deletions
diff --git a/debian/patches/ruby3.0_compatibility.patch b/debian/patches/ruby3.0_compatibility.patch
deleted file mode 100644
index c35dc0b..0000000
--- a/debian/patches/ruby3.0_compatibility.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From: taichi <taichi730@gmail.com>
-Subject: Grab two patches from upstream to fix compatibility with Ruby 3.0.
- [PATCH] fixed warnings caused by keyword argument change
- [PATCH] adapted for obsoletion of URI.encode method
-
-Origin: upstream
-Bug-Debian: https://bugs.debian.org/996371
-
----
- lib/roo/csv.rb | 27 +++++++++++++++++++++++----
- lib/roo/spreadsheet.rb | 10 ++++++++--
- 2 files changed, 31 insertions(+), 6 deletions(-)
-
---- a/lib/roo/csv.rb 2021-10-30 21:50:24.101318627 -0400
-+++ b/lib/roo/csv.rb 2021-10-30 21:50:24.089318711 -0400
-@@ -90,17 +90,36 @@
- def each_row(options, &block)
- if uri?(filename)
- each_row_using_tempdir(options, &block)
-- elsif is_stream?(filename_or_stream)
-- ::CSV.new(filename_or_stream, options).each(&block)
- else
-- ::CSV.foreach(filename, options, &block)
-+ csv_foreach(filename_or_stream, options, &block)
- end
- end
-
- def each_row_using_tempdir(options, &block)
- ::Dir.mktmpdir(Roo::TEMP_PREFIX, ENV["ROO_TMP"]) do |tmpdir|
- tmp_filename = download_uri(filename, tmpdir)
-- ::CSV.foreach(tmp_filename, options, &block)
-+ csv_foreach(tmp_filename, options, &block)
-+ end
-+ end
-+
-+ # From Ruby 2.5, options argument of CSV.new/CSV.foreach is a keyword argument.
-+ # Before Ruby 2.5, that argument is a Hash.
-+ # Therefore, this workaround can be removed if Ruby 2.3 and 2.4 are dropped.
-+ if RUBY_VERSION >= '2.5.0'
-+ def csv_foreach(path_or_io, options, &block)
-+ if is_stream?(path_or_io)
-+ ::CSV.new(path_or_io, **options).each(&block)
-+ else
-+ ::CSV.foreach(path_or_io, **options, &block)
-+ end
-+ end
-+ else
-+ def csv_foreach(path_or_io, options, &block)
-+ if is_stream?(path_or_io)
-+ ::CSV.new(path_or_io, options).each(&block)
-+ else
-+ ::CSV.foreach(path_or_io, options, &block)
-+ end
- end
- end
-
---- a/lib/roo/spreadsheet.rb 2021-10-30 21:50:24.101318627 -0400
-+++ b/lib/roo/spreadsheet.rb 2021-10-30 21:50:24.089318711 -0400
-@@ -24,8 +24,14 @@
- options[:file_warning] = :ignore
- extension.tr('.', '').downcase.to_sym
- else
-- res = ::File.extname((path =~ /\A#{::URI::DEFAULT_PARSER.make_regexp}\z/) ? ::URI.parse(::URI.encode(path)).path : path)
-- res.tr('.', '').downcase.to_sym
-+ parsed_path =
-+ if path =~ /\A#{::URI::DEFAULT_PARSER.make_regexp}\z/
-+ # path is 7th match
-+ Regexp.last_match[7]
-+ else
-+ path
-+ end
-+ ::File.extname(parsed_path).tr('.', '').downcase.to_sym
- end
- end
- end