summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-05 03:31:28 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-05 03:31:28 +0000
commit85164e551a41d6b71224a364497af76acd147d03 (patch)
tree617e4cdff79a6756856a10f73d2434eab8e920d0 /lib
parent6c77ae07a5f90f625346ac4193ad8c63c62ba5a1 (diff)
* lib/rubygems.rb: Bump version to 2.0.1 for upcoming bugfix release
* lib/rubygems/ext/ext_conf_builder.rb: Restore ruby 1.8 compatibility for [Bug #9698] * test/rubygems/test_gem_installer.rb: Ditto. * lib/rubygems/package.rb: Restore ruby 1.8 compatibility. * test/rubygems/test_gem_dependency_installer.rb: Fix warnings git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb52
-rw-r--r--lib/rubygems/package.rb5
3 files changed, 32 insertions, 27 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index f85117d673..226ff69db5 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = '2.0.0'
+ VERSION = '2.0.1'
end
# Must be first since it unloads the prelude from 1.9.2
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 3df7637581..39d772326a 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -13,41 +13,45 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
FileEntry = FileUtils::Entry_ # :nodoc:
def self.build(extension, directory, dest_path, results, args=[])
- tmp_dest = (Dir.mktmpdir(".gem.", ".") if File.identical?(dest_path, "."))
+ tmp_dest = Dir.mktmpdir(".gem.", ".") if File.identical?(dest_path, ".")
- siteconf = Tempfile.open(%w"siteconf .rb", ".") do |f|
- f.puts "require 'rbconfig'"
- f.puts "dest_path = #{(tmp_dest || dest_path).dump}"
+ Tempfile.open %w"siteconf .rb", "." do |siteconf|
+ siteconf.puts "require 'rbconfig'"
+ siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}"
%w[sitearchdir sitelibdir].each do |dir|
- f.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
- f.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
+ siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
+ siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
end
- f
- end
- rubyopt = ENV["RUBYOPT"]
- ENV["RUBYOPT"] = ["-r#{siteconf.path}", rubyopt].compact.join(' ')
- cmd = [Gem.ruby, File.basename(extension), *args].join ' '
+ siteconf.flush
+
+ rubyopt = ENV["RUBYOPT"]
+ destdir = ENV["DESTDIR"]
+
+ begin
+ ENV["RUBYOPT"] = ["-r#{siteconf.path}", rubyopt].compact.join(' ')
+ cmd = [Gem.ruby, File.basename(extension), *args].join ' '
- run cmd, results
+ run cmd, results
- destdir = ENV["DESTDIR"]
- ENV["DESTDIR"] = nil
+ ENV["DESTDIR"] = nil
- make dest_path, results
+ make dest_path, results
- if tmp_dest
- FileEntry.new(tmp_dest).traverse do |ent|
- destent = ent.class.new(dest_path, ent.rel)
- destent.exist? or File.rename(ent.path, destent.path)
+ if tmp_dest
+ FileEntry.new(tmp_dest).traverse do |ent|
+ destent = ent.class.new(dest_path, ent.rel)
+ destent.exist? or File.rename(ent.path, destent.path)
+ end
+ end
+
+ results
+ ensure
+ ENV["RUBYOPT"] = rubyopt
+ ENV["DESTDIR"] = destdir
end
end
-
- results
ensure
- ENV["RUBYOPT"] = rubyopt
- ENV["DESTDIR"] = destdir
- siteconf.close(true) if siteconf
FileUtils.rm_rf tmp_dest if tmp_dest
end
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 301eef48cc..7e2458c3b6 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -387,8 +387,9 @@ EOM
@spec = Gem::Specification.from_yaml entry.read
when 'metadata.gz' then
args = [entry]
- args << { :external_encoding => Encoding::UTF_8 } unless
- Zlib::GzipReader.method(:wrap).arity == 1
+ args << { :external_encoding => Encoding::UTF_8 } if
+ Object.const_defined?(:Encoding) &&
+ Zlib::GzipReader.method(:wrap).arity != 1
Zlib::GzipReader.wrap(*args) do |gzio|
@spec = Gem::Specification.from_yaml gzio.read