Class: Dependabot::Python::FileParser::SetupFileParser
- Inherits:
-
Object
- Object
- Dependabot::Python::FileParser::SetupFileParser
- Defined in:
- lib/dependabot/python/file_parser/setup_file_parser.rb
Constant Summary collapse
- INSTALL_REQUIRES_REGEX =
/install_requires\s*=\s*\[/m
- SETUP_REQUIRES_REGEX =
/setup_requires\s*=\s*\[/m
- TESTS_REQUIRE_REGEX =
/tests_require\s*=\s*\[/m
- EXTRAS_REQUIRE_REGEX =
/extras_require\s*=\s*\{/m
- CLOSING_BRACKET =
{ "[" => "]", "{" => "}" }.freeze
Instance Method Summary collapse
- #dependency_set ⇒ Object
-
#initialize(dependency_files:) ⇒ SetupFileParser
constructor
A new instance of SetupFileParser.
Constructor Details
#initialize(dependency_files:) ⇒ SetupFileParser
Returns a new instance of SetupFileParser.
23 24 25 |
# File 'lib/dependabot/python/file_parser/setup_file_parser.rb', line 23 def initialize(dependency_files:) @dependency_files = dependency_files end |
Instance Method Details
#dependency_set ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dependabot/python/file_parser/setup_file_parser.rb', line 27 def dependency_set dependencies = Dependabot::FileParsers::Base::DependencySet.new parsed_setup_file.each do |dep| # If a requirement has a `<` or `<=` marker then updating it is # probably blocked. Ignore it. next if dep["markers"].include?("<") # If the requirement is our inserted version, ignore it # (we wouldn't be able to update it) next if dep["version"] == "0.0.1+dependabot" dependencies << Dependency.new( name: normalised_name(dep["name"], dep["extras"]), version: dep["version"]&.include?("*") ? nil : dep["version"], requirements: [{ requirement: dep["requirement"], file: Pathname.new(dep["file"]).cleanpath.to_path, source: nil, groups: [dep["requirement_type"]] }], package_manager: "pip" ) end dependencies end |