in modular_cli/modular_cli_autocomplete/complete_handler.py [0:0]
def _get_interpreter_and_appropriate_script():
if sys.platform not in ['darwin', 'linux']:
raise Exception(
f'The OS is not applicable for autocompletion '
f'setup. Current OS is {sys.platform}')
stdout = subprocess.check_output(COMMAND_TO_CHECK_INTERPRETER,
shell=True).decode('utf-8').strip()
_LOG.info(f'Current interpreter: {stdout}')
if not stdout:
raise Exception(
f'The interpreter can not be checked. Modular-CLI '
f'autocomplete installation will be skipped...')
interpreter, script = _get_appropriate_script_name(stdout)
if not interpreter:
raise Exception(
f'Unsupported interpreter {stdout}. Modular-CLI '
f'autocomplete installation will be skipped...')
return interpreter, script