[pypy-commit] pypy remove-translator-platform: a branch to use platformer instead of translator/platform and to remove the latter

fijal noreply at buildbot.pypy.org
Mon May 21 15:16:55 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: remove-translator-platform
Changeset: r55145:bcd415c6e103
Date: 2012-05-21 15:16 +0200
http://bitbucket.org/pypy/pypy/changeset/bcd415c6e103/

Log:	a branch to use platformer instead of translator/platform and to
	remove the latter

diff --git a/pypy/translator/c/genc.py b/pypy/translator/c/genc.py
--- a/pypy/translator/c/genc.py
+++ b/pypy/translator/c/genc.py
@@ -7,23 +7,14 @@
 from pypy.translator.gensupp import uniquemodulename, NameManager
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.rpython.lltypesystem import lltype
-from pypy.tool.udir import udir
+from pypy.tool.udir import udir, pypydir
 from pypy.tool import isolate, runsubprocess
-from pypy.translator.c.support import log, c_string_constant
+from pypy.translator.c.support import log
 from pypy.rpython.typesystem import getfunctionptr
 from pypy.translator.c import gc
 from pypy.rlib import exports
 from pypy.tool.nullpath import NullPyPathLocal
 
-def import_module_from_directory(dir, modname):
-    file, pathname, description = imp.find_module(modname, [str(dir)])
-    try:
-        mod = imp.load_module(modname, file, pathname, description)
-    finally:
-        if file:
-            file.close()
-    return mod
-
 class ProfOpt(object):
     #XXX assuming gcc style flags for now
     name = "profopt"
@@ -35,7 +26,6 @@
         platform = self.compiler.platform
         if platform.name.startswith('darwin'):
             # XXX incredible hack for darwin
-            cfiles = self.compiler.cfiles
             STR = '/*--no-profiling-for-this-file!--*/'
             no_prof = []
             prof = []
@@ -256,7 +246,8 @@
                                             split=self.split)
         self.c_source_filename = py.path.local(cfile)
         self.extrafiles = self.eventually_copy(extra)
-        self.gen_makefile(targetdir, exe_name=exe_name)
+        self.gen_makefile(targetdir, exe_name=exe_name, proj_dir=pypydir,
+                          proj_main_function="pypy_main_startup")
         return cfile
 
     def eventually_copy(self, cfiles):
@@ -1007,6 +998,6 @@
         fi.close()
 
     eci = add_extra_files(eci)
-    eci = eci.convert_sources_to_files(being_main=True)
+    eci = eci.convert_sources_to_files(main_clause='"#define NOT_MAIN_FILE\n')
     files, eci = eci.get_module_files()
     return eci, filename, sg.getextrafiles() + list(files)
diff --git a/pypy/translator/c/src/main.h b/pypy/translator/c/src/main.h
--- a/pypy/translator/c/src/main.h
+++ b/pypy/translator/c/src/main.h
@@ -15,8 +15,8 @@
 
 #ifndef PYPY_NOT_MAIN_FILE
 
-#ifndef PYPY_MAIN_FUNCTION
-#define PYPY_MAIN_FUNCTION main
+#ifndef MAIN_FUNCTION
+#define MAIN_FUNCTION main
 #endif
 
 #ifdef __GNUC__


More information about the pypy-commit mailing list