ソースを参照

Fix open() to correctly call the forwarding _open_ function.

[SVN r37656]
Rene Rivera 19 年 前
コミット
746133a80c
2 ファイル変更18 行追加7 行削除
  1. 8 6
      tools/buildbot/src/boost/patchwork.py
  2. 10 1
      tools/buildbot/src/buildbot.py

+ 8 - 6
tools/buildbot/src/boost/patchwork.py

@@ -139,11 +139,13 @@ class patchwork_loader:
         else:
             #~ print "\tZIP FILE: %s" % (self.path);
             source += self.importer.get_data(self.path).replace("\r\n","\n").replace("\r","\n")
-        source += "\n\n"
-        #~ source += "print '[%s].[open] == %s ... %s' % (__name__,open, isinstance(open,type) )\n"
-        #~ source += "print '[%s].[file] == %s ... %s' % (__name__,file, isinstance(file,type) )\n"
-        source += "if isinstance(open,type):\n\tfrom boost.patchwork import _open_ as open\n"
-        source += "if isinstance(file,type):\n\tfrom boost.patchwork import _file_ as file\n"
+        source += '''
+import __builtin__
+if __builtin__.open == open:
+    from boost.patchwork import _open_ as open
+if isinstance(file,type):
+    from boost.patchwork import _file_ as file
+'''
         code = compiler.compile(source,self.path,'exec')
         mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
         mod.__file__ = os.path.join(self.importer.archive,self.path)
@@ -171,7 +173,7 @@ class patchwork_importer:
             raise ImportError
     
     def find_module(self,fullname,path=None):
-        print "--- patchwork_importer.find_module(self,\n\t%s,\n\t%s)" % (fullname,path)
+        #~ print "--- patchwork_importer.find_module(self,\n\t%s,\n\t%s)" % (fullname,path)
         
         loader = None
         for package in _g_.packages_to_search:

+ 10 - 1
tools/buildbot/src/buildbot.py

@@ -6,14 +6,23 @@
 #~ http://www.boost.org/LICENSE_1_0.txt)
 
 import sys
+import os
 import os.path
-import pprint
+import urllib
 
 from boost.patchwork import def_modules
 
 #~ The directory this file is in.
 root = os.path.abspath( os.path.dirname(__file__ ) )
 
+#~ Download current packages.
+#~ if not os.path.isdir(os.path.join(root,'_packages')):
+    #~ os.mkdir(os.path.join(root,'_packages'))
+#~ if not os.path.isdir(os.path.join(root,'_packages')):
+    #~ sys.exit('No _packages directory found.')
+#~ urllib.urlretrieve('',os.path.join(root,'_packages',''))
+#~ urllib.urlretrieve('',os.path.join(root,'_packages',''))
+
 #~ Bootstrap Boost package.
 #~ sys.path.insert(0,os.path.join(root,'_packages','boost-0.0.1.zip'))
 

粤ICP备19079148号