dependabot-python 0.110.16 → 0.110.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81218b4f113548c19d097c51e0a0a2d7176b06cae1a395ae5ba59c0d5aa1f5ac
4
- data.tar.gz: 3a01854f6401e1a759c67d5c73786a039069d9de1e0de491ad86b1f71ef5c379
3
+ metadata.gz: 92b0bdc62cbfd3cbef19f87843e133359f893c29f27b0abbc59d3d570ebc4b92
4
+ data.tar.gz: b8256f11710fa5c15b5254a455ef66241db66aeae53a724febcd0fcf1a34efc3
5
5
  SHA512:
6
- metadata.gz: 56be2eefcd3e3c39349c65ce9949ca1df0a6faf96cca11d8398897544b7c53520ad0cad63c4e5cd8b9ec1cda87d670387b522282b61e6730bd8cf17d4de4882c
7
- data.tar.gz: eb1625b1b81c87fdf13abbe4707e0e97de4f05343c8bd0debe4707995cb500034f01a30d4d294482e811e073a6235268655320c44fb448c54819866bfaca8a94
6
+ metadata.gz: 391c44dc7177193877550bb2bf80ed36f65e8b6da3ab43b61a609a8e3c55e0731f7443ea00cf98d8fe078dbdfeaa4b56fb793fb4b536af541b235e720a34dcef
7
+ data.tar.gz: 56600829da49450e9bd34b9039c015d1f82d113b51e6578587b2579c1d935f3927eaa101762edc9e54e4d559b596e45726c480b50b28426ab550e15751d90456
@@ -17,12 +17,14 @@ module Dependabot
17
17
  @dependency_files = dependency_files
18
18
  end
19
19
 
20
- def user_specified_requirement
21
- pipfile_python_requirement ||
22
- pyproject_python_requirement ||
23
- python_version_file_version ||
24
- runtime_file_python_version ||
20
+ def user_specified_requirements
21
+ [
22
+ pipfile_python_requirement,
23
+ pyproject_python_requirement,
24
+ python_version_file_version,
25
+ runtime_file_python_version,
25
26
  setup_file_requirement
27
+ ].compact
26
28
  end
27
29
 
28
30
  # TODO: Add better Python version detection using dependency versions
@@ -91,9 +93,14 @@ module Dependabot
91
93
  def setup_file_requirement
92
94
  return unless setup_file
93
95
 
94
- setup_file.content.
95
- match(/python_requires\s*=\s*['"](?<req>[^'"]+)['"]/)&.
96
- named_captures&.fetch("req")&.strip
96
+ req = setup_file.content.
97
+ match(/python_requires\s*=\s*['"](?<req>[^'"]+)['"]/)&.
98
+ named_captures&.fetch("req")&.strip
99
+
100
+ requirement_class.new(req)
101
+ req
102
+ rescue Gem::Requirement::BadRequirementError
103
+ nil
97
104
  end
98
105
 
99
106
  def pyenv_versions
@@ -532,13 +532,14 @@ module Dependabot
532
532
  end
533
533
 
534
534
  def user_specified_python_version
535
- return unless python_requirement_parser.user_specified_requirement
535
+ unless python_requirement_parser.user_specified_requirements.any?
536
+ return
537
+ end
536
538
 
537
- user_specified_requirement =
538
- Dependabot::Python::Requirement.new(
539
- python_requirement_parser.user_specified_requirement
540
- )
541
- python_version_matching([user_specified_requirement])
539
+ user_specified_requirements =
540
+ python_requirement_parser.user_specified_requirements.
541
+ map { |r| Python::Requirement.requirements_array(r) }
542
+ python_version_matching(user_specified_requirements)
542
543
  end
543
544
 
544
545
  def python_version_matching_imputed_requirements
@@ -552,7 +553,11 @@ module Dependabot
552
553
  def python_version_matching(requirements)
553
554
  PythonVersions::SUPPORTED_VERSIONS_TO_ITERATE.find do |version_string|
554
555
  version = Python::Version.new(version_string)
555
- requirements.all? { |req| req.satisfied_by?(version) }
556
+ requirements.all? do |req|
557
+ next req.any? { |r| r.satisfied_by?(version) } if req.is_a?(Array)
558
+
559
+ req.satisfied_by?(version)
560
+ end
556
561
  end
557
562
  end
558
563
 
@@ -386,7 +386,7 @@ module Dependabot
386
386
  end
387
387
 
388
388
  def user_specified_python_requirement
389
- python_requirement_parser.user_specified_requirement
389
+ python_requirement_parser.user_specified_requirements.first
390
390
  end
391
391
 
392
392
  def python_requirement_parser
@@ -232,20 +232,17 @@ module Dependabot
232
232
  end
233
233
 
234
234
  def python_version
235
- requirement = user_specified_python_requirement
236
- requirements = Python::Requirement.requirements_array(requirement)
235
+ requirements = python_requirement_parser.user_specified_requirements
236
+ requirements = requirements.
237
+ map { |r| Python::Requirement.requirements_array(r) }
237
238
 
238
239
  PythonVersions::SUPPORTED_VERSIONS_TO_ITERATE.find do |version|
239
- requirements.any? do |r|
240
- r.satisfied_by?(Python::Version.new(version))
240
+ requirements.all? do |reqs|
241
+ reqs.any? { |r| r.satisfied_by?(Python::Version.new(version)) }
241
242
  end
242
243
  end
243
244
  end
244
245
 
245
- def user_specified_python_requirement
246
- python_requirement_parser.user_specified_requirement
247
- end
248
-
249
246
  def python_requirement_parser
250
247
  @python_requirement_parser ||=
251
248
  FileParser::PythonRequirementParser.new(
@@ -448,13 +448,14 @@ module Dependabot
448
448
  end
449
449
 
450
450
  def user_specified_python_version
451
- return unless python_requirement_parser.user_specified_requirement
451
+ unless python_requirement_parser.user_specified_requirements.any?
452
+ return
453
+ end
452
454
 
453
- user_specified_requirement =
454
- Dependabot::Python::Requirement.new(
455
- python_requirement_parser.user_specified_requirement
456
- )
457
- python_version_matching([user_specified_requirement])
455
+ user_specified_requirements =
456
+ python_requirement_parser.user_specified_requirements.
457
+ map { |r| Python::Requirement.requirements_array(r) }
458
+ python_version_matching(user_specified_requirements)
458
459
  end
459
460
 
460
461
  def python_version_matching_imputed_requirements
@@ -468,7 +469,11 @@ module Dependabot
468
469
  def python_version_matching(requirements)
469
470
  PythonVersions::SUPPORTED_VERSIONS_TO_ITERATE.find do |version_string|
470
471
  version = Python::Version.new(version_string)
471
- requirements.all? { |req| req.satisfied_by?(version) }
472
+ requirements.all? do |req|
473
+ next req.any? { |r| r.satisfied_by?(version) } if req.is_a?(Array)
474
+
475
+ req.satisfied_by?(version)
476
+ end
472
477
  end
473
478
  end
474
479
 
@@ -54,13 +54,14 @@ module Dependabot
54
54
  end
55
55
 
56
56
  def user_specified_python_version
57
- return unless python_requirement_parser.user_specified_requirement
57
+ unless python_requirement_parser.user_specified_requirements.any?
58
+ return
59
+ end
58
60
 
59
- user_specified_requirement =
60
- Dependabot::Python::Requirement.new(
61
- python_requirement_parser.user_specified_requirement
62
- )
63
- python_version_matching([user_specified_requirement])
61
+ user_specified_requirements =
62
+ python_requirement_parser.user_specified_requirements.
63
+ map { |r| Python::Requirement.requirements_array(r) }
64
+ python_version_matching(user_specified_requirements)
64
65
  end
65
66
 
66
67
  def python_version_matching_imputed_requirements
@@ -74,7 +75,11 @@ module Dependabot
74
75
  def python_version_matching(requirements)
75
76
  PythonVersions::SUPPORTED_VERSIONS_TO_ITERATE.find do |version_string|
76
77
  version = Python::Version.new(version_string)
77
- requirements.all? { |req| req.satisfied_by?(version) }
78
+ requirements.all? do |req|
79
+ next req.any? { |r| r.satisfied_by?(version) } if req.is_a?(Array)
80
+
81
+ req.satisfied_by?(version)
82
+ end
78
83
  end
79
84
  end
80
85
 
@@ -407,7 +407,7 @@ module Dependabot
407
407
  end
408
408
 
409
409
  def user_specified_python_requirement
410
- python_requirement_parser.user_specified_requirement
410
+ python_requirement_parser.user_specified_requirements.first
411
411
  end
412
412
 
413
413
  def python_requirement_parser
@@ -189,11 +189,14 @@ module Dependabot
189
189
  end
190
190
 
191
191
  def python_version
192
- requirement = user_specified_python_requirement
193
- requirements = Python::Requirement.requirements_array(requirement)
192
+ requirements = python_requirement_parser.user_specified_requirements
193
+ requirements = requirements.
194
+ map { |r| Python::Requirement.requirements_array(r) }
194
195
 
195
196
  version = PythonVersions::SUPPORTED_VERSIONS_TO_ITERATE.find do |v|
196
- requirements.any? { |r| r.satisfied_by?(Python::Version.new(v)) }
197
+ requirements.all? do |reqs|
198
+ reqs.any? { |r| r.satisfied_by?(Python::Version.new(v)) }
199
+ end
197
200
  end
198
201
  return version if version
199
202
 
@@ -204,10 +207,6 @@ module Dependabot
204
207
  raise DependencyFileNotResolvable, msg
205
208
  end
206
209
 
207
- def user_specified_python_requirement
208
- python_requirement_parser.user_specified_requirement
209
- end
210
-
211
210
  def python_requirement_parser
212
211
  @python_requirement_parser ||=
213
212
  FileParser::PythonRequirementParser.new(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-python
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.110.16
4
+ version: 0.110.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.110.16
19
+ version: 0.110.17
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.110.16
26
+ version: 0.110.17
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement