Class: Dependabot::Python::SharedFileFetcher
- Inherits:
-
FileFetchers::Base
- Object
- FileFetchers::Base
- Dependabot::Python::SharedFileFetcher
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dependabot/python/shared_file_fetcher.rb
Direct Known Subclasses
Constant Summary collapse
- CHILD_REQUIREMENT_REGEX =
T.let(/^-r\s?(?<path>.*\.(?:txt|in))/, Regexp)
- CONSTRAINT_REGEX =
T.let(/^-c\s?(?<path>.*\.(?:txt|in))/, Regexp)
- DEPENDENCY_TYPES =
T.let(%w(packages dev-packages).freeze, T::Array[String])
- MAX_FILE_SIZE =
T.let(500_000, Integer)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.ecosystem_specific_required_files ⇒ Object
30 |
# File 'lib/dependabot/python/shared_file_fetcher.rb', line 30 def self.ecosystem_specific_required_files; end |
.required_files_in?(filenames) ⇒ Boolean
33 34 35 36 37 38 39 40 |
# File 'lib/dependabot/python/shared_file_fetcher.rb', line 33 def self.required_files_in?(filenames) return true if filenames.any? { |name| name.end_with?(".txt", ".in") } return true if filenames.include?("requirements") return true if filenames.include?("pyproject.toml") return true if filenames.any? { |name| ecosystem_specific_required_files.include?(name) } false end |
Instance Method Details
#ecosystem_versions ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dependabot/python/shared_file_fetcher.rb', line 43 def ecosystem_versions python_requirement_parser = FileParser::PythonRequirementParser.new(dependency_files: files) language_version_manager = LanguageVersionManager.new(python_requirement_parser: python_requirement_parser) Dependabot.logger.info("Dependabot is using Python version '#{language_version_manager.python_version}'.") { languages: { python: { "raw" => language_version_manager.user_specified_python_version || "unknown", "max" => language_version_manager.python_major_minor || "unknown" } } } end |
#fetch_files ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/dependabot/python/shared_file_fetcher.rb', line 58 def fetch_files fetched_files = [] fetched_files += ecosystem_specific_files fetched_files += pyproject_files fetched_files += requirements_in_files fetched_files += requirement_files if requirements_txt_files.any? fetched_files += project_files fetched_files << python_version_file if python_version_file uniques = uniq_files(fetched_files) uniques.reject do |file| Dependabot::FileFiltering.should_exclude_path?(file.name, "file from final collection", @exclude_paths) end end |