def install_pip_packages(progress, priority=Priority.NONE): # Urgent updates don't do PIP updates if priority == Priority.URGENT: return phase_name = progress.get_current_phase().name packages = read_file_contents_as_lines(PIP_PACKAGES_LIST) progress.init_steps(phase_name, len(packages)) for pkg in packages: progress.next_step(phase_name, "Installing {}".format(pkg)) success = run_pip_command( "install --upgrade --no-index --find-links=file://{} '{}'".format( PIP_CACHE_DIR, pkg) ) if not success: msg = "Installing the '{}' pip package failed".format(pkg) logger.error(msg) if not is_internet(): msg = "Network is down, aborting PIP install" logger.error(msg) raise IOError(msg) # Try with the failsafe method success_failsafe = run_pip_command( "install --upgrade '{}'".format(pkg) ) if not success_failsafe: msg = "Installing the '{}' pip package failed (fsafe)".format( pkg) logger.error(msg)
def install_pip_packages(progress, priority=Priority.NONE): # Urgent updates don't do PIP updates if priority == Priority.URGENT: return phase_name = progress.get_current_phase().name packages = read_file_contents_as_lines(PIP_PACKAGES_LIST) progress.init_steps(phase_name, len(packages)) for pkg in packages: progress.next_step(phase_name, "Installing {}".format(pkg)) success = run_pip_command( "install --upgrade --no-index --find-links=file://{} '{}'".format( PIP_CACHE_DIR, pkg)) if not success: msg = "Installing the '{}' pip package failed".format(pkg) logger.error(msg) if not is_internet(): msg = "Network is down, aborting PIP install" logger.error(msg) raise IOError(msg) # Try with the failsafe method success_failsafe = run_pip_command( "install --upgrade '{}'".format(pkg)) if not success_failsafe: msg = "Installing the '{}' pip package failed (fsafe)".format( pkg) logger.error(msg)
def _cache_pip_packages(progress, priority=Priority.NONE): """ Downloads all updatable python modules and caches them in pip's internal pacakge cache. """ # Urgent updates don't do PIP updates if priority == Priority.URGENT: return phase_name = 'downloading-pip-pkgs' progress.start(phase_name) ensure_dir(PIP_CACHE_DIR) packages = read_file_contents_as_lines(PIP_PACKAGES_LIST) progress.init_steps(phase_name, len(packages)) for pkg in packages: progress.next_step(phase_name, "Downloading {}".format(pkg)) # The `--no-install` parameter has been deprecated in pip. However, the # version of pip in wheezy doesn't yet support the new approach which # is supposed to provide the same behaviour. args = "install --upgrade --download '{}' '{}'".format(PIP_CACHE_DIR, pkg) success = run_pip_command(args) # TODO: abort the install? if not success: msg = "Downloading the '{}' pip package failed.".format(pkg) logger.error(msg)
def _cache_pip_packages(progress, priority=Priority.NONE): """ Downloads all updatable python modules and caches them in pip's internal pacakge cache. """ # Urgent updates don't do PIP updates if priority == Priority.URGENT: return phase_name = 'downloading-pip-pkgs' progress.start(phase_name) ensure_dir(PIP_CACHE_DIR) packages = read_file_contents_as_lines(PIP_PACKAGES_LIST) progress.init_steps(phase_name, len(packages)) for pkg in packages: progress.next_step(phase_name, _("Downloading {}").format(pkg)) # The `--no-install` parameter has been deprecated in pip. However, the # version of pip in wheezy doesn't yet support the new approach which # is supposed to provide the same behaviour. args = "download --dest '{}' '{}'".format(PIP_CACHE_DIR, pkg) success = run_pip_command(args) # TODO: abort the install? if not success: msg = "Downloading the '{}' pip package failed.".format(pkg) logger.error(msg)
def _cache_pip_packages(progress): """ Downloads all updatable python modules and caches them in pip's internal pacakge cache. """ phase_name = 'downloading-pip-pkgs' progress.start(phase_name) packages = read_file_contents_as_lines(PIP_PACKAGES_LIST) progress.init_steps(phase_name, len(packages)) for pkg in packages: progress.next_step(phase_name, "Downloading {}".format(pkg)) # The `--no-install` parameter has been deprecated in pip. However, the # version of pip in wheezy doesn't yet support the new approach which # is supposed to provide the same behaviour. args = "install --upgrade --no-install {}".format(pkg) success = run_pip_command(args) # TODO: abort the install? if not success: msg = "Downloading the '{}' pip package failed.".format(pkg) logger.error(msg)
def install_pip_packages(progress): phase_name = progress.get_current_phase().name packages = read_file_contents_as_lines(PIP_PACKAGES_LIST) progress.init_steps(phase_name, len(packages)) for pkg in packages: progress.next_step(phase_name, "Installing {}".format(pkg)) success = run_pip_command("install --upgrade {}".format(pkg)) # TODO: abort the install? if not success: msg = "Installing the '{}' pip package failed".format(pkg) logger.error(msg)