Class: Dependabot::Python::UpdateChecker::PipenvVersionResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/python/update_checker/pipenv_version_resolver.rb

Constant Summary collapse

GIT_DEPENDENCY_UNREACHABLE_REGEX =
/git clone --filter=blob:none --quiet (?<url>[^\s]+).*/
GIT_REFERENCE_NOT_FOUND_REGEX =
/git checkout -q (?<tag>[^\s]+).*/
PIPENV_INSTALLATION_ERROR_NEW =
"Getting requirements to build wheel exited with 1"
PIPENV_INSTALLATION_ERROR_OLD =

Can be removed when Python 3.11 support is dropped

Regexp.quote("python setup.py egg_info exited with 1")
PIPENV_INSTALLATION_ERROR =
/#{PIPENV_INSTALLATION_ERROR_NEW}|#{PIPENV_INSTALLATION_ERROR_OLD}/
PIPENV_INSTALLATION_ERROR_REGEX =
/[\s\S]*Collecting\s(?<name>.+)\s\(from\s-r.+\)[\s\S]*(#{PIPENV_INSTALLATION_ERROR})/
PIPENV_RANGE_WARNING =
/Python version range specifier '(?<ver>.*)' is not supported/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, dependency_files:, credentials:, repo_contents_path:) ⇒ PipenvVersionResolver

Returns a new instance of PipenvVersionResolver.



40
41
42
43
44
45
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 40

def initialize(dependency:, dependency_files:, credentials:, repo_contents_path:)
  @dependency               = dependency
  @dependency_files         = dependency_files
  @credentials              = credentials
  @repo_contents_path       = repo_contents_path
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



37
38
39
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 37

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



35
36
37
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 35

def dependency
  @dependency
end

#dependency_filesObject (readonly)

Returns the value of attribute dependency_files.



36
37
38
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 36

def dependency_files
  @dependency_files
end

#repo_contents_pathObject (readonly)

Returns the value of attribute repo_contents_path.



38
39
40
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 38

def repo_contents_path
  @repo_contents_path
end

Instance Method Details

#latest_resolvable_version(requirement: nil) ⇒ Object



47
48
49
50
51
52
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 47

def latest_resolvable_version(requirement: nil)
  version_string =
    fetch_latest_resolvable_version_string(requirement: requirement)

  version_string.nil? ? nil : Python::Version.new(version_string)
end

#resolvable?(version:) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
58
59
# File 'lib/dependabot/python/update_checker/pipenv_version_resolver.rb', line 54

def resolvable?(version:)
  @resolvable ||= {}
  return @resolvable[version] if @resolvable.key?(version)

  @resolvable[version] = !!fetch_latest_resolvable_version_string(requirement: "==#{version}")
end