[前][次][番号順一覧][スレッド一覧]

ruby-changes:2438

From: ko1@a...
Date: 15 Nov 2007 12:32:45 +0900
Subject: [ruby-changes:2438] akr - Ruby:r13929 (trunk): * tool/compile_prelude.rb: use constant for prefix.

akr	2007-11-15 12:32:26 +0900 (Thu, 15 Nov 2007)

  New Revision: 13929

  Modified files:
    trunk/ChangeLog
    trunk/tool/compile_prelude.rb

  Log:
    * tool/compile_prelude.rb: use constant for prefix.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/tool/compile_prelude.rb?r1=13929&r2=13928
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13929&r2=13928

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13928)
+++ ChangeLog	(revision 13929)
@@ -1,3 +1,7 @@
+Thu Nov 15 12:31:13 2007  Tanaka Akira  <akr@f...>
+
+	* tool/compile_prelude.rb: use constant for prefix.
+
 Thu Nov 15 12:24:39 2007  Tanaka Akira  <akr@f...>
 
 	* tool/compile_prelude.rb: use simple template system for source
Index: tool/compile_prelude.rb
===================================================================
--- tool/compile_prelude.rb	(revision 13928)
+++ tool/compile_prelude.rb	(revision 13929)
@@ -23,6 +23,7 @@
 
 mkconf = nil
 setup_ruby_prefix = nil
+teardown_ruby_prefix = nil
 lines_list = preludes.map {|filename|
   lines = []
   need_ruby_prefix = false
@@ -30,13 +31,14 @@
     line.gsub!(/RbConfig::CONFIG\["(\w+)"\]/) {
       unless mkconf
         require 'rbconfig'
-        mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{ruby_prefix}')
+        mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{TMP_RUBY_PREFIX}')
         exlen = $:.grep(%r{\A/}).last.length - RbConfig::CONFIG["prefix"].length
-        setup_ruby_prefix = "ruby_prefix = $:.grep(%r{\\A/}).last[0..#{-exlen-1}]\n"
+        setup_ruby_prefix = "TMP_RUBY_PREFIX = $:.grep(%r{\\A/}).last[0..#{-exlen-1}]\n"
+        teardown_ruby_prefix = 'Object.class_eval { remove_const "TMP_RUBY_PREFIX" }'
       end
       if RbConfig::MAKEFILE_CONFIG.has_key? $1
         val = RbConfig.expand("$(#$1)", mkconf)
-        need_ruby_prefix = true if /\A\#{ruby_prefix\}/ =~ val
+        need_ruby_prefix = true if /\A\#{TMP_RUBY_PREFIX\}/ =~ val
         c_esc(val)
       else
         $&
@@ -47,6 +49,7 @@
   setup_lines = []
   if need_ruby_prefix
     setup_lines << c_esc(setup_ruby_prefix)
+    lines << c_esc(teardown_ruby_prefix)
   end
   [setup_lines, lines]
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]