Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump tzinfo from 1.2.5 to 1.2.6 in /Library/Homebrew #6866

Merged
merged 2 commits into from Dec 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/Gemfile.lock
Expand Up @@ -103,7 +103,7 @@ GEM
thor (1.0.1)
thread_safe (0.3.6)
tins (1.22.2)
tzinfo (1.2.5)
tzinfo (1.2.6)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/vendor/bundle/bundler/setup.rb
Expand Up @@ -7,7 +7,7 @@
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.7.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.13.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.2.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.2.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib"
Expand Down
Expand Up @@ -137,10 +137,40 @@ def self.force_encoding(str, encoding)
def self.open_file(file_name, mode, opts, &block)
File.open(file_name, mode, &block)
end
else
elsif RUBY_VERSION =~ /\A1\.9\./
def self.open_file(file_name, mode, opts, &block)
File.open(file_name, mode, opts, &block)
end
else
# Evaluate method as a string because **opts isn't valid syntax prior to
# Ruby 2.0.
eval(<<-EOF
def self.open_file(file_name, mode, opts, &block)
File.open(file_name, mode, **opts, &block)
end
EOF
)
end


# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
# 3.0. Add a refinement to either silence the warning, or supply the method
# if needed.
old_verbose = $VERBOSE
$VERBOSE = false
begin
o = Object.new
if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || !o.taint.tainted?
module UntaintExt
refine Object do
def untaint
self
end
end
end
end
ensure
$VERBOSE = old_verbose
end
end
end
@@ -1,20 +1,37 @@
module TZInfo
using RubyCoreSupport::UntaintExt if RubyCoreSupport.const_defined?(:UntaintExt)

# A DataSource that loads data from the set of Ruby modules included in the
# TZInfo::Data library (tzinfo-data gem).
#
# To have TZInfo use this DataSource, call TZInfo::DataSource.set as follows:
#
# TZInfo::DataSource.set(:ruby)
class RubyDataSource < DataSource
# Base path for require.
REQUIRE_PATH = File.join('tzinfo', 'data', 'definitions')

# Whether the timezone index has been loaded yet.
@@timezone_index_loaded = false

# Whether the country index has been loaded yet.
@@country_index_loaded = false

# Initializes a new RubyDataSource instance.
def initialize
tzinfo_data = File.join('tzinfo', 'data')
begin
require(tzinfo_data)

data_file = File.join('', 'tzinfo', 'data.rb')
path = $".reverse_each.detect {|p| p.end_with?(data_file) }
if path
@base_path = File.join(File.dirname(path), 'data').untaint
else
@base_path = tzinfo_data
end
rescue LoadError
@base_path = tzinfo_data
end
end

# Returns a TimezoneInfo instance for a given identifier.
# Raises InvalidTimezoneIdentifier if the timezone is not found or the
# identifier is invalid.
Expand Down Expand Up @@ -93,27 +110,17 @@ def require_definition(identifier)
end

# Requires an index by its name.
def self.require_index(name)
def require_index(name)
require_data(*['indexes', name])
end

# Requires a file from tzinfo/data.
def require_data(*file)
self.class.require_data(*file)
end

# Requires a file from tzinfo/data.
def self.require_data(*file)
require File.join('tzinfo', 'data', *file)
require(File.join(@base_path, *file))
end

# Loads in the index of timezones if it hasn't already been loaded.
def load_timezone_index
self.class.load_timezone_index
end

# Loads in the index of timezones if it hasn't already been loaded.
def self.load_timezone_index
unless @@timezone_index_loaded
require_index('timezones')
@@timezone_index_loaded = true
Expand All @@ -122,11 +129,6 @@ def self.load_timezone_index

# Loads in the index of countries if it hasn't already been loaded.
def load_country_index
self.class.load_country_index
end

# Loads in the index of countries if it hasn't already been loaded.
def self.load_country_index
unless @@country_index_loaded
require_index('countries')
@@country_index_loaded = true
Expand Down
Expand Up @@ -571,17 +571,21 @@ def current_period_and_time
# version 2.0.0, %z will be passed to Time#strftime and DateTime#strftime
# instead. Some of the formatting options may cease to be available
# depending on the version of Ruby in use (for example, %:::z is only
# supported by Time#strftime from MRI version 2.0.0 onwards.)
# supported by Time#strftime from MRI version 2.0.0 onwards).
def strftime(format, utc = Time.now.utc)
utc = TimeOrDateTime.wrap(utc)
period = period_for_utc(utc)
local = period.to_local(utc)
local = Time.at(local).utc unless local.kind_of?(Time) || local.kind_of?(DateTime)
local_wrapped = period.to_local(utc)
local = local_wrapped.to_orig
local = local_wrapped.to_time unless local.kind_of?(Time) || local.kind_of?(DateTime)
abbreviation = period.abbreviation.to_s.gsub(/%/, '%%')

format = format.gsub(/%(%*)(Z|:*z)/) do
format = format.gsub(/%(%*)([sZ]|:*z)/) do
if $1.length.odd?
# Escaped literal percent or series of percents. Pass on to strftime.
"#$1%#$2"
elsif $2 == "s"
"#$1#{utc.to_i}"
elsif $2 == "Z"
"#$1#{abbreviation}"
else
Expand Down
@@ -1,4 +1,12 @@
module TZInfo
# Use send as a workaround for an issue on JRuby 9.2.9.0 where using the
# refinement causes calls to RubyCoreSupport.file_open to fail to pass the
# block parameter.
#
# https://travis-ci.org/tzinfo/tzinfo/jobs/628812051#L1931
# https://github.com/jruby/jruby/issues/6009
send(:using, TZInfo::RubyCoreSupport::UntaintExt) if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt)

# An InvalidZoneinfoDirectory exception is raised if the DataSource is
# set to a specific zoneinfo path, which is not a valid zoneinfo directory
# (i.e. a directory containing index files named iso3166.tab and zone.tab
Expand Down
@@ -1,4 +1,6 @@
module TZInfo
using RubyCoreSupport::UntaintExt if RubyCoreSupport.const_defined?(:UntaintExt)

# An InvalidZoneinfoFile exception is raised if an attempt is made to load an
# invalid zoneinfo file.
class InvalidZoneinfoFile < StandardError
Expand Down