Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cli.py to work with java sdk #310

Merged
merged 4 commits into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions stone/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def main():
# The module should should contain an api variable that references a
# :class:`stone.api.Api` object.
try:
api_module = _load_module('api', args.api[0])
api_module = _load_module(args.api[0])
api = api_module.api # pylint: disable=redefined-outer-name
except ImportError as e:
print('error: Could not import API description due to:',
Expand Down Expand Up @@ -341,7 +341,7 @@ def main():
if new_python_path not in sys.path:
sys.path.append(new_python_path)
try:
backend_module = _load_module('user_backend', args.backend)
backend_module = _load_module(args.backend)
except Exception:
print("error: Importing backend '%s' module raised an exception:" %
args.backend, file=sys.stderr)
Expand All @@ -367,7 +367,7 @@ def main():
# easier to do debugging.
return api

def _load_module(name, path):
def _load_module(path):
file_name = os.path.basename(path)
module_name = file_name.replace('.', '_')

Expand All @@ -379,8 +379,8 @@ def _load_module(name, path):
loader = importlib.machinery.SourceFileLoader(module_name, path)
module = loader.load_module() # pylint: disable=deprecated-method,no-value-for-parameter

sys.modules[name] = module

sys.modules[module_name] = module
logging.info("Loading module: %s", module_name)
return module

if __name__ == '__main__':
Expand Down