-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fa3f0b
commit 1567eac
Showing
2 changed files
with
50 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Wrapper code writer for the package.""" | ||
|
||
from typing import Dict | ||
|
||
from cppwg.writers.module_writer import CppModuleWrapperWriter | ||
|
||
|
||
class CppPackageWrapperWriter: | ||
""" | ||
Class to generates Python bindings for all modules in the package. | ||
Attributes | ||
---------- | ||
package_info : PackageInfo | ||
The package information to generate Python bindings for | ||
wrapper_templates : Dict[str, str] | ||
String templates with placeholders for generating wrapper code | ||
wrapper_root : str | ||
The output directory for the generated wrapper code | ||
""" | ||
|
||
def __init__( | ||
self, | ||
package_info: "PackageInfo", # noqa: F821 | ||
wrapper_templates: Dict[str, str], | ||
wrapper_root: str, | ||
): | ||
self.package_info = package_info | ||
self.wrapper_templates = wrapper_templates | ||
self.wrapper_root = wrapper_root | ||
|
||
def write(self) -> None: | ||
""" | ||
Write all the wrappers required for the package. | ||
""" | ||
for module_info in self.package_info.module_info_collection: | ||
module_writer = CppModuleWrapperWriter( | ||
module_info, | ||
self.wrapper_templates, | ||
self.wrapper_root, | ||
) | ||
module_writer.write() |