Commits

Jeremy Thurgood  committed e179cc8

Collect built filepaths.

  • Participants
  • Parent commits 3492369
  • Branches split-verify

Comments (0)

Files changed (2)

         self._module_name = module_name
         self._module_path = module_path
         self.ffi = FFI(backend=backend)
+        self._built_files = []
         self._module_source = "\n".join([
             "from cffi import FFI",
             "",
         self.ffi.verifier = Verifier(
             self.ffi, source, force_generic_engine=True, **kwargs)
         libfilename = '_'.join([self._module_name, libname])
-        self.ffi.verifier.make_library(
-            os.path.join(self._module_path, libfilename + _get_so_suffix()))
+        libfilepath = os.path.join(
+            self._module_path, libfilename + _get_so_suffix())
+        self.ffi.verifier.make_library(libfilepath)
         self._module_source += '\n'.join([
             "def load_%s():",
             "    from cffi.verifier import Verifier",
             "    return verifier._load_library()",
             "",
         ]) % (libname, libfilename)
+        self._built_files.append(libfilepath)
 
     def write_ffi_module(self):
         import os
         except OSError:
             pass
 
-        module_filename = self._module_name + '.py'
-        file = open(os.path.join(self._module_path, module_filename), 'w')
+        module_filepath = os.path.join(
+            self._module_path, self._module_name + '.py')
+        file = open(module_filepath, 'w')
         try:
             file.write(self._module_source)
         finally:
             file.close()
+        self._built_files.append(module_filepath)
+
+    def list_built_files(self):
+        return self._built_files

File testing/test_makelib.py

 import math
 import sys
 from cffi import FFIBuilder
+from cffi.verifier import _get_so_suffix
 
 
 def _clean_modules(tmpdir, module_name):
     builder.makelib('foo', '#include <math.h>')
     builder.write_ffi_module()
 
+    assert builder.list_built_files() == [
+        str(tmpdir.join('foo_ffi_foo' + _get_so_suffix())),
+        str(tmpdir.join('foo_ffi.py')),
+    ]
+
     sys.path.append(str(tmpdir))
     try:
         import foo_ffi
     builder.add_dlopen('foo', "m")
     builder.write_ffi_module()
 
+    assert builder.list_built_files() == [
+        str(tmpdir.join('foo_ffi.py')),
+    ]
+
     sys.path.append(str(tmpdir))
     try:
         import foo_ffi
     builder.add_dlopen('bar', "m")
     builder.write_ffi_module()
 
+    assert builder.list_built_files() == [
+        str(tmpdir.join('foo_ffi_foo' + _get_so_suffix())),
+        str(tmpdir.join('foo_ffi.py')),
+    ]
+
     sys.path.append(str(tmpdir))
     try:
         import foo_ffi