Class: Dependabot::Python::PoetryErrorHandler
- Inherits:
-
UpdateChecker
- Object
- UpdateCheckers::Base
- UpdateChecker
- Dependabot::Python::PoetryErrorHandler
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/python/update_checker/poetry_version_resolver.rb
Constant Summary collapse
- INVALID_CONFIGURATION =
if a valid config value is not found in project.toml file
/The Poetry configuration is invalid:(?<config>.*)/- INVALID_VERSION =
if .toml has incorrect version specification i.e. <0.2.0app
/Could not parse version constraint: (?<ver>.*)/- INVALID_LINK =
dependency source link not accessible
/No valid distribution links found for package: "(?<dep>.*)" version: "(?<ver>.*)"/- PYTHON_RANGE_NOT_SATISFIED =
Python version range mentioned in .toml [tool.poetry.dependencies] python = “x.x” is not satisfied by dependency
/(?<dep>.*) requires Python (?<req_ver>.*), so it will not be satisfied for Python (?<men_ver>.*)/- PACKAGE_NOT_FOUND =
package version mentioned in .toml not found in package index
/Package (?<pkg>.*) ((?<req_ver>.*)) not found./- CLIENT_ERROR_CODES =
client access error codes while accessing package index
T.let({ error401: /401 Client Error/, error403: /403 Client Error/, error404: /404 Client Error/, http403: /HTTP error 403/, http404: /HTTP error 404/ }.freeze, T::Hash[T.nilable(String), Regexp])
- SERVER_ERROR_CODES =
server response error codes while accessing package index
T.let({ server500: /500 Server Error/, server502: /502 Server Error/, server503: /503 Server Error/, server504: /504 Server Error/ }.freeze, T::Hash[T.nilable(String), Regexp])
- POETRY_VIRTUAL_ENV_CONFIG =
invalid configuration in pyproject.toml
%r{pypoetry/virtualenvs(.|\n)*list index out of range}- ERR_LOCAL_PROJECT_PATH =
error related to local project as dependency in pyproject.toml
/Path (?<path>.*) for (?<dep>.*) does not exist/- TIME_OUT_ERRORS =
T.let({ time_out_max_retries: /Max retries exceeded/, time_out_read_timed_out: /Read timed out/, time_out_inactivity: /Timed out due to inactivity/ }.freeze, T::Hash[T.nilable(String), Regexp])
- PACKAGE_RESOLVER_ERRORS =
T.let({ package_info_error: /Unable to determine package info/, self_dep_error: /Package '(?<path>.*)' is listed as a dependency of itself./, incompatible_constraints: /Incompatible constraints in requirements/ }.freeze, T::Hash[T.nilable(String), Regexp])
Constants inherited from UpdateChecker
UpdateChecker::MAIN_PYPI_INDEXES, UpdateChecker::VERSION_REGEX
Instance Method Summary collapse
- #handle_poetry_error(error) ⇒ Object
-
#initialize(dependencies:, dependency_files:) ⇒ PoetryErrorHandler
constructor
A new instance of PoetryErrorHandler.
Methods inherited from UpdateChecker
#latest_resolvable_version, #latest_resolvable_version_with_no_unlock, #latest_version, #lowest_resolvable_security_fix_version, #lowest_security_fix_version, #requirements_unlocked_or_can_be?, #requirements_update_strategy, #updated_requirements
Constructor Details
#initialize(dependencies:, dependency_files:) ⇒ PoetryErrorHandler
397 398 399 400 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 397 def initialize(dependencies:, dependency_files:) @dependencies = dependencies @dependency_files = dependency_files end |
Instance Method Details
#handle_poetry_error(error) ⇒ Object
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 425 def handle_poetry_error(error) Dependabot.logger.warn(error.) if (msg = error..match(PoetryVersionResolver::INCOMPATIBLE_CONSTRAINTS) || error..match(INVALID_CONFIGURATION) || error..match(INVALID_VERSION) || error..match(INVALID_LINK)) raise DependencyFileNotResolvable, msg end if (msg = error..match(PACKAGE_NOT_FOUND)) raise DependencyFileNotResolvable, msg end raise DependencyFileNotResolvable, error. if error..match(PYTHON_RANGE_NOT_SATISFIED) if error..match(POETRY_VIRTUAL_ENV_CONFIG) || error..match(ERR_LOCAL_PROJECT_PATH) msg = "Error while resolving pyproject.toml file" raise DependencyFileNotResolvable, msg end SERVER_ERROR_CODES.each do |(_error_codes, error_regex)| next unless error..match?(error_regex) index_url = URI.extract(error..to_s).last .then { sanitize_url(_1) } raise InconsistentRegistryResponse, index_url end TIME_OUT_ERRORS.each do |(_error_codes, error_regex)| next unless error..match?(error_regex) raise InconsistentRegistryResponse, "Inconsistent registry response" end CLIENT_ERROR_CODES.each do |(_error_codes, error_regex)| next unless error..match?(error_regex) index_url = URI.extract(error..to_s).last .then { sanitize_url(_1) } raise PrivateSourceAuthenticationFailure, index_url end PACKAGE_RESOLVER_ERRORS.each do |(_error_codes, error_regex)| next unless error..match?(error_regex) = "Package solving failed while resolving manifest file" raise DependencyFileNotResolvable, end end |