[pypy-svn] r35404 - pypy/dist/pypy/translator

antocuni at codespeak.net antocuni at codespeak.net
Wed Dec 6 18:15:56 CET 2006


Author: antocuni
Date: Wed Dec  6 18:15:54 2006
New Revision: 35404

Modified:
   pypy/dist/pypy/translator/driver.py
Log:
Copy the .NET executable in the goal dir after the compilation.



Modified: pypy/dist/pypy/translator/driver.py
==============================================================================
--- pypy/dist/pypy/translator/driver.py	(original)
+++ pypy/dist/pypy/translator/driver.py	Wed Dec  6 18:15:54 2006
@@ -581,9 +581,32 @@
             unpatch(*self.old_cli_defs)
         
         self.log.info("Compiled %s" % filename)
+        if self.standalone:
+            self.copy_cli_exe()
     task_compile_cli = taskdef(task_compile_cli, ['source_cli'],
                               'Compiling CLI source')
 
+    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')
+
+        shutil.copy(main_exe, '.')
+        shutil.copy(pypylib_dll, '.')
+        newexename = self.exe_name % self.get_info()
+        if '/' not in newexename and '\\' not in newexename:
+            newexename = './' + newexename
+        f = file(newexename, 'w')
+        f.write("""#!/bin/bash
+cd `dirname $0` # XXX doesn't work if it's placed in PATH
+mono "%s" "$@"
+""" % main_exe_name)
+        f.close()
+        os.chmod(newexename, 0755)
+
     def task_run_cli(self):
         pass
     task_run_cli = taskdef(task_run_cli, ['compile_cli'],



More information about the Pypy-commit mailing list