[pypy-commit] pypy default: create larger c files by indexing directories together (previously each file was seperate)

mattip pypy.commits at gmail.com
Mon Mar 7 13:06:28 EST 2016


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r82860:3c4aee3b5f7a
Date: 2016-02-08 21:53 +0200
http://bitbucket.org/pypy/pypy/changeset/3c4aee3b5f7a/

Log:	create larger c files by indexing directories together (previously
	each file was seperate)

diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -547,6 +547,8 @@
                         relpypath = localpath.relto(pypkgpath.dirname)
                         assert relpypath, ("%r should be relative to %r" %
                             (localpath, pypkgpath.dirname))
+                        if len(relpypath.split(os.path.sep)) > 2:
+                            return os.path.split(relpypath)[0] + '.c'
                         return relpypath.replace('.py', '.c')
             return None
         if hasattr(node.obj, 'graph'):
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -123,9 +123,9 @@
 
         # Verify that the generated C files have sane names:
         gen_c_files = [str(f) for f in cbuilder.extrafiles]
-        for expfile in ('rpython_rlib_rposix.c',
-                        'rpython_rtyper_lltypesystem_rstr.c',
-                        'rpython_translator_c_test_test_standalone.c'):
+        for expfile in ('rpython_rlib.c',
+                        'rpython_rtyper_lltypesystem.c',
+                        'rpython_translator_c_test.c'):
             assert cbuilder.targetdir.join(expfile) in gen_c_files
 
     def test_print(self):


More information about the pypy-commit mailing list