[pypy-svn] r59122 - pypy/branch/cbuild-refactor/pypy/translator/platform

fijal at codespeak.net fijal at codespeak.net
Thu Oct 16 00:08:11 CEST 2008


Author: fijal
Date: Thu Oct 16 00:08:11 2008
New Revision: 59122

Modified:
   pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py
   pypy/branch/cbuild-refactor/pypy/translator/platform/maemo.py
Log:
Hack differently. Invoke make from inside scratchbox. Looks a bit cleaner IMO


Modified: pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py
==============================================================================
--- pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py	(original)
+++ pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py	Thu Oct 16 00:08:11 2008
@@ -242,15 +242,7 @@
             path = path_to_makefile
         log.execute('make in %s' % (path,))
         returncode, stdout, stderr = _run_subprocess('make', ['-C', str(path)])
-        if returncode != 0:
-            errorfile = path.join('make.errors')
-            errorfile.write(stderr)
-            stderrlines = stderr.splitlines()
-            for line in stderrlines[:5]:
-                log.ERROR(line)
-            if len(stderrlines) > 5:
-                log.ERROR('...')
-            raise CompilationError(stdout, stderr)
+        self._handle_error(returncode, stdout, stderr, path.join('make'))
 
     def include_dirs_for_libffi(self):
         return ['/usr/include/libffi']

Modified: pypy/branch/cbuild-refactor/pypy/translator/platform/maemo.py
==============================================================================
--- pypy/branch/cbuild-refactor/pypy/translator/platform/maemo.py	(original)
+++ pypy/branch/cbuild-refactor/pypy/translator/platform/maemo.py	Thu Oct 16 00:08:11 2008
@@ -76,54 +76,11 @@
         # on the other hand, library lands in usual place...
         return []
 
-    
-    def gen_makefile(self, cfiles, eci, exe_name=None, path=None):
-        cfiles = [py.path.local(f) for f in cfiles]
-        cfiles += [py.path.local(f) for f in eci.separate_module_files]
-
-        if path is None:
-            path = cfiles[0].dirpath()
-
-        pypypath = py.path.local(autopath.pypydir)
-
-        if exe_name is None:
-            exe_name = cfiles[0].new(ext='')
-
-        m = GnuMakefile(path)
-        m.exe_name = exe_name
-        m.eci = eci
-
-        rel_cfiles = [str(cfile) for cfile in cfiles]
-        rel_ofiles = [rel_cfile[:-2]+'.o' for rel_cfile in rel_cfiles]
-        m.cfiles = rel_cfiles
-
-        rel_includedirs = [str(incldir) for incldir in
-                           self._preprocess_dirs(eci.include_dirs)]
-
-        m.comment('automatically generated makefile')
-        definitions = [
-            ('TARGET', str(exe_name)),
-            ('DEFAULT_TARGET', '$(TARGET)'),
-            ('SOURCES', rel_cfiles),
-            ('OBJECTS', rel_ofiles),
-            ('LIBS', self._libs(eci.libraries)),
-            ('LIBDIRS', self._libdirs(eci.library_dirs)),
-            ('INCLUDEDIRS', self._includedirs(rel_includedirs)),
-            ('CFLAGS', self.cflags + list(eci.compile_extra)),
-            ('LDFLAGS', self.link_flags + list(eci.link_extra)),
-            ('CC', '/scratchbox/login ' + self.cc)
-            ]
-        for args in definitions:
-            m.definition(*args)
-
-        rules = [
-            ('all', '$(DEFAULT_TARGET)', []),
-            ('$(TARGET)', '$(OBJECTS)', '$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBDIRS) $(LIBS)'),
-            ('%.o', '%.c', '$(CC) $(CFLAGS) -o $@ -c $< $(INCLUDEDIRS)'),
-            ]
-
-        for rule in rules:
-            m.rule(*rule)
-
-        return m
-
+    def execute_makefile(self, path_to_makefile):
+        if isinstance(path_to_makefile, GnuMakefile):
+            path = path_to_makefile.makefile_dir
+        else:
+            path = path_to_makefile
+        log.execute('make in %s' % (path,))
+        returncode, stdout, stderr = _run_subprocess('/scratchbox/login', ['make', '-C', str(path)])
+        self._handle_error(returncode, stdout, stderr, path.join('make'))



More information about the Pypy-commit mailing list