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>.*\.(?:txt|in))/.freeze

Class Method Summary collapse

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)

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

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


30
31
32
33
# File 'lib/dependabot/python/file_fetcher.rb', line 30

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