def install_language(env_manager, language_version, sudo_password=""): if env_manager == LanguageManager.PYENV: check_command = f"pyenv versions" check_response = run_command(check_command) if language_version in check_response: logger.info( f"Language Environment Manager: Already installed language version [language=python, version={language_version}]" ) return logger.info( f"Language Environment Manager: Installing language version (this might take a bit, ~2 min) [language=python, version={language_version}]" ) command = f"pyenv install {language_version}" run_command(command) logger.info( f"Language Environment Manager: Successfully installed language version [language=python, version={language_version}]" ) elif env_manager == LanguageManager.JENV: host_system = OS.get_host_system() package_manager = OS.get_package_manager(host_system) if package_manager == PackageManager.BREW: install_java_version_via_homebrew(language_version, sudo_password) else: raise NotImplementedError( f"Language Environment Manager: Sorry, the requested package manager is not currently supported [package_manager={package_manager}]" ) else: raise NotImplementedError( "Language Environment Manager: Sorry, the requested language manager is not currently supported (feel free to open an issue at https://github.com/JasonYao/pydotfiles/issues/new)" )
def uninstall_language_environment_manager(env_manager): host_system = OS.get_host_system() package_manager = OS.get_package_manager(host_system) if package_manager == PackageManager.BREW: uninstall_language_environment_manager_via_homebrew(env_manager) else: raise NotImplementedError( f"Language Environment Manager: Sorry, the requested package manager is not currently supported [package_manager={package_manager}]" )
def uninstall(self): if not self.is_installed: logger.info( f"Language Environment Plugin Manager: Already uninstalled language environment plugin manager [env_plugin_manager={self.language_plugin_manager}]" ) return host_system = OS.get_host_system() package_manager = OS.get_package_manager(host_system) if package_manager == PackageManager.BREW: uninstall_language_environment_plugin_manager_via_homebrew( self.language_plugin_manager) else: raise NotImplementedError( f"Language Environment Plugin Manager: Sorry, the requested package manager is not currently supported [package_manager={package_manager}]" )
def uninstall_language(env_manager, language_version, sudo_password=""): if env_manager == LanguageManager.PYENV: check_command = f"pyenv versions" check_response = run_command(check_command) if language_version not in check_response: logger.info( f"Language Environment Manager: Already uninstalled language version [language=python, version={language_version}]" ) return logger.info( f"Language Environment Manager: Uninstalling language version [language=python, version={language_version}]" ) command = f"pyenv uninstall {language_version}" run_command_with_communication( command, "y\n" ) # The 'y\n' is to confirm that we want to uninstall the given python version logger.info( f"Language Environment Manager: Successfully uninstalled language version [language=python, version={language_version}]" ) elif env_manager == LanguageManager.JENV: host_system = OS.get_host_system() package_manager = OS.get_package_manager(host_system) if package_manager == PackageManager.BREW: uninstall_java_version_via_homebrew(language_version, sudo_password) else: raise NotImplementedError( f"Language Environment Manager: Sorry, the requested package manager is not currently supported [package_manager={package_manager}]" ) else: raise NotImplementedError( "Language Environment Manager: Sorry, the requested language manager is not currently supported (feel free to open an issue at https://github.com/JasonYao/pydotfiles/issues/new)" )