def _allowed_to_proceed(self, verbose): """Display which files would be deleted and prompt for confirmation """ def _display(msg, paths): if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(paths)): logger.info(path) if not verbose: will_remove, will_skip = compress_for_output_listing(self.paths) else: # In verbose mode, display all the files that are going to be # deleted. will_remove = list(self.paths) will_skip = set() _display('Would remove:', will_remove) _display('Would not remove (might be manually added):', will_skip) _display('Would not remove (outside of prefix):', self._refuse) if verbose: _display('Will actually move:', compress_for_rename(self.paths)) return ask('Proceed (y/n)? ', ('y', 'n')) == 'y'
def _allowed_to_proceed(self, verbose: bool) -> bool: """Display which files would be deleted and prompt for confirmation""" def _display(msg: str, paths: Iterable[str]) -> None: if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(paths)): logger.info(path) if not verbose: will_remove, will_skip = compress_for_output_listing(self._paths) else: # In verbose mode, display all the files that are going to be # deleted. will_remove = set(self._paths) will_skip = set() _display("Would remove:", will_remove) _display("Would not remove (might be manually added):", will_skip) _display("Would not remove (outside of prefix):", self._refuse) if verbose: _display("Will actually move:", compress_for_rename(self._paths)) return ask("Proceed (Y/n)? ", ("y", "n", "")) != "n"
def install(version, target): if not target: abort('Task argument "target" is required.') current_dir = os.path.dirname(__file__) project_path = current_dir pkg_version = setuptools_get_version(project_path) pkg_name = setuptools_get_name(project_path) if not version: version = pkg_version print('Installing package {0}, version {1} to target {2}.'.format( *list(map(yellow, [pkg_name, version, target])))) if env.confirm: response = ask('Proceed (y/n)? ', ('y', 'n')) else: response = 'y' if response == 'y': # From filesystem #source_package = '~/install/PatZilla/PatZilla-{version}.tar.gz'.format(version=version) # From PyPI source_package = 'patzilla=={version}'.format(version=version) source_config = './patzilla/config/production.ini.tpl' target_path = os.path.join(INSTALLATION_PATH, 'sites', target) dir_ensure(target_path, recursive=True) venv_path = target_path + '/.venv2' #if not file_is_file(source_package): # abort('Source package does not exist: ' + source_package) if not file_is_dir(target_path): abort('Target path does not exist: ' + target_path) if not file_is_dir(venv_path): run('virtualenv --no-site-packages "{0}"'.format(venv_path)) #setup_package('which', venv_path) # TODO: put these packages to a more convenient location setup_package(source_package, venv_path) upload_config(source_config, target_path) restart_service(target) else: print(yellow('Skipped package install due to user request.'))
def _should_save_password_to_keyring(self): if not keyring: return False return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y"
auth = get_keyring_auth(netloc, username) if auth: >>>>>>> b66a76afa15ab74019740676a52a071b85ed8f71 return auth[0], auth[1], False password = ask_password("Password: "******"Save credentials to keyring [y/N]: ", ["y", "n"]) == "y" def handle_401(self, resp, **kwargs): <<<<<<< HEAD # type: (Response, **Any) -> Response ======= >>>>>>> b66a76afa15ab74019740676a52a071b85ed8f71 # We only care about 401 responses, anything else we want to just # pass through the actual response if resp.status_code != 401: return resp # We are not able to prompt the user so simply return the response if not self.prompting: return resp