def create_and_import(self, xml): name = inspect.stack()[1][3] path = os.path.join(self.package_tests_path, name) if os.access(path, os.F_OK): shutil.rmtree(path) xml = xml.format(root = name) structure = CTypesStructure.from_xml(xml_from_string(xml)) structure.packages[name].add_library(Library("mock", self.mock_library_path, True)) export_structure(structure, self.package_tests_path) mod = import_module(name) return mod
def generate_ctypes_api(input, output_path, package = None, display_unprocessed = False, display_processed = False): if isinstance(package, basestring): package = import_object(package)() structure = CTypesStructure.load(input) if display_unprocessed: structure.display() if package: package.process_ctypes_structure(structure) if display_processed: structure.display() export_structure(structure, output_path)