Skip to content

Commit

Permalink
cppbase: deprecate usage of binding_class_name
Browse files Browse the repository at this point in the history
this reintroduces the previous usage of binding_class_name, so that
updating pymoskito doesn't break old pybinds.
a friendly warning is generated, mentioning that this is now deprecated.
  • Loading branch information
jhalmen committed Feb 16, 2022
1 parent 226a45f commit 357d523
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pymoskito/binding_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self,
module_name=None,
binding_source=None,
additional_sources=None,
binding_class_name=None,
additional_lib=None):
self._logger = logging.getLogger(self.__class__.__name__)

Expand All @@ -74,9 +75,15 @@ def __init__(self,
raise BindingException(message)

if binding_source is None:
message = "Instantiation of binding class without binding_source is not allowed!"
self._logger.error(message)
raise BindingException(message)
if binding_class_name is not None:
binding_source = binding_class_name + ".cpp"
module_source = module_name + ".cpp"
additional_sources = additional_sources.append(module_source) if additional_sources else [module_source]
self._logger.warn("Use of binding_class_name is deprecated. Please migrate to binding_source")
else:
message = "Instantiation of binding class without binding_source is not allowed!"
self._logger.error(message)
raise BindingException(message)

self.module_path = Path(module_path)
self.module_binding = self.module_path / binding_source
Expand Down

0 comments on commit 357d523

Please sign in to comment.