Class: Dependabot::Python::FileFetcher

Inherits:
FileFetchers::Base
  • Object
show all
Defined in:
lib/dependabot/python/file_fetcher.rb

Constant Summary collapse

CHILD_REQUIREMENT_REGEX =
/^-r\s?(?<path>.*\.(?:txt|in))/
CONSTRAINT_REGEX =
/^-c\s?(?<path>.*\.(?:txt|in))/
DEPENDENCY_TYPES =
%w(packages dev-packages)

Class Method Summary collapse

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dependabot/python/file_fetcher.rb', line 18

def self.required_files_in?(filenames)
  return true if filenames.any? { |name| name.end_with?(".txt", ".in") }

  # If there is a directory of requirements return true
  return true if filenames.include?("requirements")

  # If this repo is using a Pipfile return true
  return true if filenames.include?("Pipfile")

  # If this repo is using pyproject.toml return true
  return true if filenames.include?("pyproject.toml")

  return true if filenames.include?("setup.py")

  filenames.include?("setup.cfg")
end

.required_files_messageObject



35
36
37
38
# File 'lib/dependabot/python/file_fetcher.rb', line 35

def self.required_files_message
  "Repo must contain a requirements.txt, setup.py, setup.cfg, pyproject.toml, " \
    "or a Pipfile."
end