[pypy-svn] r58873 - in pypy/dist/pypy/translator: . tool

xoraxax at codespeak.net xoraxax at codespeak.net
Fri Oct 10 10:17:03 CEST 2008


Author: xoraxax
Date: Fri Oct 10 10:17:02 2008
New Revision: 58873

Modified:
   pypy/dist/pypy/translator/driver.py
   pypy/dist/pypy/translator/tool/staticsizereport.py
Log:
Copy the staticsizeinfo also to goal, clean up driver a bit.

Modified: pypy/dist/pypy/translator/driver.py
==============================================================================
--- pypy/dist/pypy/translator/driver.py	(original)
+++ pypy/dist/pypy/translator/driver.py	Fri Oct 10 10:17:02 2008
@@ -1,4 +1,6 @@
 import sys, os
+import os.path
+import shutil
 
 from pypy.translator.translator import TranslationContext, graphof
 from pypy.translator.tool.taskengine import SimpleTaskEngine
@@ -494,20 +496,22 @@
         if self.config.translation.dump_static_data_info:
             from pypy.translator.tool.staticsizereport import dump_static_data_info
             targetdir = cbuilder.targetdir
-            dump_static_data_info(self.log, database, targetdir)
+            fname = dump_static_data_info(self.log, database, targetdir)
+            shutil.copy(str(fname), self.compute_exe_name() + '.staticdata.info')
 
     #
     task_source_c = taskdef(task_source_c, ['database_c'], "Generating c source")
 
+    def compute_exe_name(self):
+        newexename = self.exe_name % self.get_info()
+        if '/' not in newexename and '\\' not in newexename:
+            newexename = './' + newexename
+        return mkexename(newexename)
+
     def create_exe(self):
         if self.exe_name is not None:
-            import shutil
             exename = mkexename(self.c_entryp)
-            info = {'backend': self.config.translation.backend}
-            newexename = self.exe_name % self.get_info()
-            if '/' not in newexename and '\\' not in newexename:
-                newexename = './' + newexename
-            newexename = mkexename(newexename)
+            newexename = self.compute_exe_name()
             shutil.copy(exename, newexename)
             self.c_entryp = newexename
         self.log.info("created: %s" % (self.c_entryp,))
@@ -650,8 +654,6 @@
 
     def copy_cli_exe(self):
         # XXX messy
-        import os.path
-        import shutil
         main_exe = self.c_entryp._exe
         usession_path, main_exe_name = os.path.split(main_exe)
         pypylib_dll = os.path.join(usession_path, 'pypylib.dll')
@@ -683,8 +685,6 @@
         os.chmod(newexename, 0755)
 
     def copy_cli_dll(self):
-        import os.path
-        import shutil
         dllname = self.gen.outfile
         usession_path, dll_name = os.path.split(dllname)
         pypylib_dll = os.path.join(usession_path, 'pypylib.dll')

Modified: pypy/dist/pypy/translator/tool/staticsizereport.py
==============================================================================
--- pypy/dist/pypy/translator/tool/staticsizereport.py	(original)
+++ pypy/dist/pypy/translator/tool/staticsizereport.py	Fri Oct 10 10:17:02 2008
@@ -176,6 +176,7 @@
     pickle.dump(info, f)
     f.close()
     log.info('static data informations dumped to %s' % infofile)
+    return infofile
 
 
 ## Functions used by the reportstaticdata.py script



More information about the Pypy-commit mailing list