Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: 
Changeset: r89791:5cf849b8cd32
Date: 2017-01-26 17:29 +0000
http://bitbucket.org/pypy/pypy/changeset/5cf849b8cd32/

Log:    Extract configure_entries() from configure()

diff --git a/rpython/rtyper/tool/rffi_platform.py 
b/rpython/rtyper/tool/rffi_platform.py
--- a/rpython/rtyper/tool/rffi_platform.py
+++ b/rpython/rtyper/tool/rffi_platform.py
@@ -214,30 +214,7 @@
             entries.append((key, value))
 
     if entries:   # can be empty if there are only CConfigSingleEntries
-        writer = _CWriter(eci)
-        writer.write_header()
-        for key, entry in entries:
-            writer.write_entry(key, entry)
-
-        writer.start_main()
-        for key, entry in entries:
-            writer.write_entry_main(key)
-        writer.close()
-
-        infolist = list(run_example_code(writer.path, eci,
-                                         ignore_errors=ignore_errors))
-        assert len(infolist) == len(entries)
-
-        resultinfo = {}
-        resultentries = {}
-        for info, (key, entry) in zip(infolist, entries):
-            resultinfo[key] = info
-            resultentries[entry] = key
-
-        result = ConfigResult(eci, resultinfo, resultentries)
-        for name, entry in entries:
-            result.get_entry_result(entry)
-        res = result.get_result()
+        res = configure_entries(entries, eci, ignore_errors=ignore_errors)
     else:
         res = {}
 
@@ -250,6 +227,33 @@
 
     return res
 
+
+def configure_entries(entries, eci, ignore_errors=False):
+    writer = _CWriter(eci)
+    writer.write_header()
+    for key, entry in entries:
+        writer.write_entry(key, entry)
+
+    writer.start_main()
+    for key, entry in entries:
+        writer.write_entry_main(key)
+    writer.close()
+
+    infolist = list(run_example_code(
+        writer.path, eci, ignore_errors=ignore_errors))
+    assert len(infolist) == len(entries)
+
+    resultinfo = {}
+    resultentries = {}
+    for info, (key, entry) in zip(infolist, entries):
+        resultinfo[key] = info
+        resultentries[entry] = key
+
+    result = ConfigResult(eci, resultinfo, resultentries)
+    for name, entry in entries:
+        result.get_entry_result(entry)
+    return result.get_result()
+
 # ____________________________________________________________
 
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to