class Dependabot::Uv::UpdateChecker::PipCompileVersionResolver
def handle_pip_compile_errors(message)
rubocop:disable Metrics/AbcSize
def handle_pip_compile_errors(message) if message.include?("No solution found when resolving dependencies") raise DependencyFileNotResolvable, message.scan(UV_UNRESOLVABLE_REGEX).last end check_original_requirements_resolvable if message.include?(RESOLUTION_IMPOSSIBLE_ERROR) # If there's an unsupported constraint, check if it existed # previously (and raise if it did) check_original_requirements_resolvable if message.include?("UnsupportedConstraint") if message.include?(RESOLUTION_IMPOSSIBLE_ERROR) && !message.match?(/#{Regexp.quote(dependency.name)}/i) # Sometimes pip-tools gets confused and can't work around # sub-dependency incompatibilities. Ignore those cases. return nil end if message.match?(GIT_REFERENCE_NOT_FOUND_REGEX) tag = message.match(GIT_REFERENCE_NOT_FOUND_REGEX).named_captures.fetch("tag") constraints_section = message.split("Finding the best candidates:").first egg_regex = /#{Regexp.escape(tag)}#egg=(#{PYTHON_PACKAGE_NAME_REGEX})/ name_match = constraints_section.scan(egg_regex) # We can determine the name of the package from another part of the logger output if it has a unique tag raise GitDependencyReferenceNotFound, name_match.first.first if name_match.length == 1 raise GitDependencyReferenceNotFound, "(unknown package at #{tag})" end if message.match?(GIT_DEPENDENCY_UNREACHABLE_REGEX) url = message.match(GIT_DEPENDENCY_UNREACHABLE_REGEX) .named_captures.fetch("url") raise GitDependenciesNotReachable, url end raise Dependabot::OutOfDisk if message.end_with?("[Errno 28] No space left on device") raise Dependabot::OutOfMemory if message.end_with?("MemoryError") error_handler.handle_pipcompile_error(message) raise end