def get_activation_script(quote=False): """ Return path for bash/batch conda activation script to run spyder-kernels. If `quote` is True, then quotes are added if spaces are found in the path. """ scripts_folder_path = os.path.join(os.path.dirname(HERE), 'scripts') if os.name == 'nt': script = 'conda-activate.bat' else: script = 'conda-activate.sh' script_path = os.path.join(scripts_folder_path, script) if quote: script_path = add_quotes(script_path) return script_path
def test_add_quotes(): output = add_quotes('/some path/with spaces') assert output == '"/some path/with spaces"' output = add_quotes('/some-path/with-no-spaces') assert output == '/some-path/with-no-spaces'