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))/.freeze
CONSTRAINT_REGEX =
/^-c\s?(?<path>\..*)/.freeze

Class Method Summary collapse

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)


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

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 Poetry return true
  return true if filenames.include?("pyproject.toml")

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

.required_files_messageObject



32
33
34
35
# File 'lib/dependabot/python/file_fetcher.rb', line 32

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