dependabot-python 0.119.0.beta1 → 0.119.4

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: 0c443c75018adfd2cf364c97de4ef952789b4b1d279c9ef325ee181e8f46cd56
4
- data.tar.gz: 3ef40c7a0ac388eea5b3a2ea5b70ca5019a0110088fae84e5913c2584d37eb8d
3
+ metadata.gz: f201c4255c524ae0ecbbfc557cdf318b8efc552d6ac6abb2e713d81e95e1cb27
4
+ data.tar.gz: 627aaaa1ad891da06db8d67f5927d72f09b635cb5f57cf1b0a45068dde6861ad
5
5
  SHA512:
6
- metadata.gz: 13bcdc6647e905be59181cac53a5e79073531940e291684b9431b68bbb16702871d56c964ea4ba4cdee736ec74f050db09b94bd0ba2b370813e5c4ae9cf7e144
7
- data.tar.gz: 8f7113e04bf9c2c2fd727ecba7c7240d1f7f518237f4c8361531370e3fa86fb712d22544bbfe5751fee6296749c3dfc179c786bdd41a3db241d164a5cd5fb6ca
6
+ metadata.gz: 6d742f3fd17de985eda66beac0c1e950fdde39d4a12bb2ad84a5fd15effb15b8fec6c7a9f3dd70941dd6367d1119bd8a74911c008cdd11f95a6d70d50a60795d
7
+ data.tar.gz: 945f396b17b6175c8139fa4dab6da997f281fe84f4618bbedc5ec3161f5138c6fd50a2b2344098ae5a10b156f21410d24be850e0a9677b2fd9e9aa7b2de8626c
@@ -3,7 +3,7 @@ pip-tools==5.3.1
3
3
  hashin==0.15.0
4
4
  pipenv==2018.11.26
5
5
  pipfile==0.0.2
6
- poetry==1.0.9
6
+ poetry==1.0.10
7
7
 
8
8
  # Some dependencies will only install if Cython is present
9
9
  Cython==0.29.21
@@ -3,7 +3,6 @@
3
3
  module Dependabot
4
4
  module Python
5
5
  class AuthedUrlBuilder
6
- # rubocop:disable Metrics/PerceivedComplexity
7
6
  def self.authed_url(credential:)
8
7
  token = credential.fetch("token", nil)
9
8
  url = credential.fetch("index-url")
@@ -24,7 +23,6 @@ module Dependabot
24
23
 
25
24
  url.sub("://", "://#{basic_auth_details}@")
26
25
  end
27
- # rubocop:enable Metrics/PerceivedComplexity
28
26
  end
29
27
  end
30
28
  end
@@ -350,14 +350,14 @@ module Dependabot
350
350
  def parse_path_setup_paths(req_file)
351
351
  uneditable_reqs =
352
352
  req_file.content.
353
- scan(/^['"]?(?<path>\..*?)(?=\[|#|'|"|$)/).
353
+ scan(/^['"]?(?:file:)?(?<path>\..*?)(?=\[|#|'|"|$)/).
354
354
  flatten.
355
355
  map(&:strip).
356
356
  reject { |p| p.include?("://") }
357
357
 
358
358
  editable_reqs =
359
359
  req_file.content.
360
- scan(/^(?:-e)\s+['"]?(?<path>.*?)(?=\[|#|'|"|$)/).
360
+ scan(/^(?:-e)\s+['"]?(?:file:)?(?<path>.*?)(?=\[|#|'|"|$)/).
361
361
  flatten.
362
362
  map(&:strip).
363
363
  reject { |p| p.include?("://") || p.include?("git@") }
@@ -44,6 +44,7 @@ module Dependabot
44
44
 
45
45
  private
46
46
 
47
+ # rubocop:disable Metrics/PerceivedComplexity
47
48
  def resolver_type
48
49
  reqs = dependencies.flat_map(&:requirements)
49
50
  changed_reqs = reqs.zip(dependencies.flat_map(&:previous_requirements)).
@@ -64,6 +65,7 @@ module Dependabot
64
65
 
65
66
  :requirements
66
67
  end
68
+ # rubocop:enable Metrics/PerceivedComplexity
67
69
 
68
70
  def subdependency_resolver
69
71
  return :pipfile if pipfile_lock
@@ -142,6 +142,7 @@ module Dependabot
142
142
  freeze_top_level_dependencies_except(dependencies)
143
143
  end
144
144
 
145
+ # rubocop:disable Metrics/PerceivedComplexity
145
146
  def freeze_dependencies_being_updated(pipfile_content)
146
147
  pipfile_object = TomlRB.parse(pipfile_content)
147
148
 
@@ -163,6 +164,7 @@ module Dependabot
163
164
 
164
165
  TomlRB.dump(pipfile_object)
165
166
  end
167
+ # rubocop:enable Metrics/PerceivedComplexity
166
168
 
167
169
  def subdep_type?(type)
168
170
  return false if dependency.top_level?
@@ -46,7 +46,6 @@ module Dependabot
46
46
  TomlRB.dump(pipfile_object)
47
47
  end
48
48
 
49
- # rubocop:disable Metrics/PerceivedComplexity
50
49
  def freeze_dependency(dep_name, pipfile_object, keys)
51
50
  locked_version = version_from_lockfile(
52
51
  keys[:lockfile],
@@ -66,7 +65,6 @@ module Dependabot
66
65
  pipfile_object[keys[:pipfile]][dep_name] = "==#{locked_version}"
67
66
  end
68
67
  end
69
- # rubocop:enable Metrics/PerceivedComplexity
70
68
 
71
69
  def update_python_requirement(requirement)
72
70
  pipfile_object = TomlRB.parse(pipfile_content)
@@ -36,7 +36,7 @@ module Dependabot
36
36
  end
37
37
 
38
38
  # rubocop:disable Metrics/PerceivedComplexity
39
- # rubocop:disable Metrics/CyclomaticComplexity
39
+ # rubocop:disable Metrics/AbcSize
40
40
  def freeze_top_level_dependencies_except(dependencies)
41
41
  return pyproject_content unless lockfile
42
42
 
@@ -71,8 +71,8 @@ module Dependabot
71
71
 
72
72
  TomlRB.dump(pyproject_object)
73
73
  end
74
+ # rubocop:enable Metrics/AbcSize
74
75
  # rubocop:enable Metrics/PerceivedComplexity
75
- # rubocop:enable Metrics/CyclomaticComplexity
76
76
 
77
77
  private
78
78
 
@@ -30,8 +30,8 @@ module Dependabot
30
30
  updated_dependency_declaration_string
31
31
  end
32
32
 
33
- unless old_requirement == new_requirement
34
- raise "Expected content to change!" if content == updated_content
33
+ if old_requirement != new_requirement && content == updated_content
34
+ raise "Expected content to change!"
35
35
  end
36
36
 
37
37
  updated_content
@@ -100,7 +100,7 @@ module Dependabot
100
100
  def convert_caret_req(req_string)
101
101
  version = req_string.gsub(/^\^/, "")
102
102
  parts = version.split(".")
103
- parts = parts.fill(0, parts.length...3)
103
+ parts.fill(0, parts.length...3)
104
104
  first_non_zero = parts.find { |d| d != "0" }
105
105
  first_non_zero_index =
106
106
  first_non_zero ? parts.index(first_non_zero) : parts.count - 1
@@ -166,6 +166,7 @@ module Dependabot
166
166
  end
167
167
  end
168
168
 
169
+ # rubocop:disable Metrics/PerceivedComplexity
169
170
  def version_details_from_link(link)
170
171
  doc = Nokogiri::XML(link)
171
172
  filename = doc.at_css("a")&.content
@@ -181,6 +182,7 @@ module Dependabot
181
182
  yanked: link&.include?("data-yanked")
182
183
  }
183
184
  end
185
+ # rubocop:enable Metrics/PerceivedComplexity
184
186
 
185
187
  def get_version_from_filename(filename)
186
188
  filename.
@@ -97,7 +97,6 @@ module Dependabot
97
97
  end
98
98
  end
99
99
 
100
- # rubocop:disable Metrics/PerceivedComplexity
101
100
  # rubocop:disable Metrics/AbcSize
102
101
  def handle_pip_compile_errors(error)
103
102
  if error.message.include?("Could not find a version")
@@ -114,11 +113,14 @@ module Dependabot
114
113
  check_original_requirements_resolvable
115
114
  end
116
115
 
117
- if error.message.include?('Command "python setup.py egg_info') ||
118
- error.message.include?("exit status 1: python setup.py egg_info")
116
+ if (error.message.include?('Command "python setup.py egg_info') ||
117
+ error.message.include?(
118
+ "exit status 1: python setup.py egg_info"
119
+ )) &&
120
+ check_original_requirements_resolvable
119
121
  # The latest version of the dependency we're updating is borked
120
122
  # (because it has an unevaluatable setup.py). Skip the update.
121
- return if check_original_requirements_resolvable
123
+ return
122
124
  end
123
125
 
124
126
  if error.message.include?("Could not find a version ") &&
@@ -143,7 +145,6 @@ module Dependabot
143
145
  raise
144
146
  end
145
147
 
146
- # rubocop:enable Metrics/PerceivedComplexity
147
148
  # rubocop:enable Metrics/AbcSize
148
149
 
149
150
  # Needed because pip-compile's resolver isn't perfect.
@@ -152,11 +152,14 @@ module Dependabot
152
152
  check_original_requirements_resolvable
153
153
  end
154
154
 
155
- if error.message.include?('Command "python setup.py egg_info"') ||
156
- error.message.include?("exit status 1: python setup.py egg_info")
155
+ if (error.message.include?('Command "python setup.py egg_info"') ||
156
+ error.message.include?(
157
+ "exit status 1: python setup.py egg_info"
158
+ )) &&
159
+ check_original_requirements_resolvable
157
160
  # The latest version of the dependency we're updating is borked
158
161
  # (because it has an unevaluatable setup.py). Skip the update.
159
- return if check_original_requirements_resolvable
162
+ return
160
163
  end
161
164
 
162
165
  if error.message.include?("UnsupportedPythonVersion") &&
@@ -332,6 +335,7 @@ module Dependabot
332
335
  freeze_top_level_dependencies_except([dependency])
333
336
  end
334
337
 
338
+ # rubocop:disable Metrics/PerceivedComplexity
335
339
  def set_target_dependency_req(pipfile_content, updated_requirement)
336
340
  return pipfile_content unless updated_requirement
337
341
 
@@ -352,6 +356,7 @@ module Dependabot
352
356
 
353
357
  TomlRB.dump(pipfile_object)
354
358
  end
359
+ # rubocop:enable Metrics/PerceivedComplexity
355
360
 
356
361
  def subdep_type?(type)
357
362
  return false if dependency.top_level?
@@ -22,12 +22,18 @@ module Dependabot
22
22
  class UpdateChecker
23
23
  # This class does version resolution for pyproject.toml files.
24
24
  class PoetryVersionResolver
25
- GIT_REFERENCE_NOT_FOUND_REGEX =
26
- /'git'.*pypoetry-git-(?<name>.+?).{8}','checkout','(?<tag>.+?)'/.
27
- freeze
28
- GIT_DEPENDENCY_UNREACHABLE_REGEX =
29
- /'\['git',\s+'clone',\s+'(?<url>.+?)'.*\s+exit\s+status\s+128/m.
30
- freeze
25
+ GIT_REFERENCE_NOT_FOUND_REGEX = /
26
+ 'git'.*pypoetry-git-(?<name>.+?).{8}',
27
+ 'checkout',
28
+ '(?<tag>.+?)'
29
+ /x.freeze
30
+ GIT_DEPENDENCY_UNREACHABLE_REGEX = /
31
+ '\['git',
32
+ \s+'clone',
33
+ \s+'--recurse-submodules',
34
+ \s+'(?<url>.+?)'.*
35
+ \s+exit\s+status\s+128
36
+ /mx.freeze
31
37
 
32
38
  attr_reader :dependency, :dependency_files, :credentials
33
39
 
@@ -252,6 +258,7 @@ module Dependabot
252
258
  freeze_top_level_dependencies_except([dependency])
253
259
  end
254
260
 
261
+ # rubocop:disable Metrics/PerceivedComplexity
255
262
  def set_target_dependency_req(pyproject_content, updated_requirement)
256
263
  return pyproject_content unless updated_requirement
257
264
 
@@ -278,6 +285,7 @@ module Dependabot
278
285
 
279
286
  TomlRB.dump(pyproject_object)
280
287
  end
288
+ # rubocop:enable Metrics/PerceivedComplexity
281
289
 
282
290
  def subdep_type
283
291
  category =
@@ -73,7 +73,6 @@ module Dependabot
73
73
  updated_requirement(req)
74
74
  end
75
75
 
76
- # rubocop:disable Metrics/PerceivedComplexity
77
76
  def updated_pyproject_requirement(req)
78
77
  return req unless latest_resolvable_version
79
78
  return req unless req.fetch(:requirement)
@@ -99,8 +98,6 @@ module Dependabot
99
98
  req.merge(requirement: :unfixable)
100
99
  end
101
100
 
102
- # rubocop:enable Metrics/PerceivedComplexity
103
-
104
101
  def update_pyproject_version(req)
105
102
  requirement_strings = req[:requirement].split(",").map(&:strip)
106
103
 
@@ -160,6 +157,7 @@ module Dependabot
160
157
  "#{req_string.strip} || #{new_option.strip}"
161
158
  end
162
159
 
160
+ # rubocop:disable Metrics/PerceivedComplexity
163
161
  def widen_requirement_range(req_string)
164
162
  requirement_strings = req_string.split(",").map(&:strip)
165
163
 
@@ -179,6 +177,7 @@ module Dependabot
179
177
  update_requirements_range(requirement_strings)
180
178
  end
181
179
  end
180
+ # rubocop:enable Metrics/PerceivedComplexity
182
181
 
183
182
  # rubocop:disable Metrics/PerceivedComplexity
184
183
  def updated_requirement(req)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-python
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.119.0.beta1
4
+ version: 0.119.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.119.0.beta1
19
+ version: 0.119.4
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.119.0.beta1
26
+ version: 0.119.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.88.0
103
+ version: 0.90.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.88.0
110
+ version: 0.90.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: vcr
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -144,11 +144,6 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - helpers/build
147
- - helpers/install-dir/python/lib/__init__.py
148
- - helpers/install-dir/python/lib/hasher.py
149
- - helpers/install-dir/python/lib/parser.py
150
- - helpers/install-dir/python/requirements.txt
151
- - helpers/install-dir/python/run.py
152
147
  - helpers/lib/__init__.py
153
148
  - helpers/lib/hasher.py
154
149
  - helpers/lib/parser.py
@@ -191,7 +186,7 @@ homepage: https://github.com/dependabot/dependabot-core
191
186
  licenses:
192
187
  - Nonstandard
193
188
  metadata: {}
194
- post_install_message:
189
+ post_install_message:
195
190
  rdoc_options: []
196
191
  require_paths:
197
192
  - lib
@@ -206,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
201
  - !ruby/object:Gem::Version
207
202
  version: 2.5.0
208
203
  requirements: []
209
- rubygems_version: 3.1.4
210
- signing_key:
204
+ rubygems_version: 3.1.2
205
+ signing_key:
211
206
  specification_version: 4
212
207
  summary: Python support for dependabot
213
208
  test_files: []
@@ -1,24 +0,0 @@
1
- import hashin
2
- import json
3
- import pipfile
4
- from poetry.poetry import Poetry
5
- from poetry.factory import Factory
6
-
7
- def get_dependency_hash(dependency_name, dependency_version, algorithm):
8
- hashes = hashin.get_package_hashes(
9
- dependency_name,
10
- version=dependency_version,
11
- algorithm=algorithm
12
- )
13
-
14
- return json.dumps({ "result": hashes["hashes"] })
15
-
16
- def get_pipfile_hash(directory):
17
- p = pipfile.load(directory + '/Pipfile')
18
-
19
- return json.dumps({ "result": p.hash })
20
-
21
- def get_pyproject_hash(directory):
22
- p = Factory().create_poetry(directory)
23
-
24
- return json.dumps({ "result": p.locker._get_content_hash() })
@@ -1,138 +0,0 @@
1
- from itertools import chain
2
- import glob
3
- import io
4
- import json
5
- import optparse
6
- import os.path
7
- import re
8
-
9
- import setuptools
10
- import pip._internal.req.req_file
11
- from pip._internal.network.session import PipSession
12
- from pip._internal.models.format_control import FormatControl
13
- from pip._internal.req.constructors import (
14
- install_req_from_line,
15
- install_req_from_parsed_requirement,
16
- )
17
-
18
- def parse_requirements(directory):
19
- # Parse the requirements.txt
20
- requirement_packages = []
21
- requirement_files = glob.glob(os.path.join(directory, '*.txt')) \
22
- + glob.glob(os.path.join(directory, '**', '*.txt'))
23
-
24
- pip_compile_files = glob.glob(os.path.join(directory, '*.in')) \
25
- + glob.glob(os.path.join(directory, '**', '*.in'))
26
-
27
- def version_from_install_req(install_req):
28
- if install_req.is_pinned:
29
- return next(iter(install_req.specifier)).version
30
-
31
- for reqs_file in requirement_files + pip_compile_files:
32
- try:
33
- requirements = pip._internal.req.req_file.parse_requirements(
34
- reqs_file,
35
- session=PipSession()
36
- )
37
- for parsed_req in requirements:
38
- install_req = install_req_from_parsed_requirement(parsed_req)
39
- if install_req.original_link:
40
- continue
41
-
42
- pattern = r"-[cr] (.*) \(line \d+\)"
43
- abs_path = re.search(pattern, install_req.comes_from).group(1)
44
- rel_path = os.path.relpath(abs_path, directory)
45
-
46
- requirement_packages.append({
47
- "name": install_req.req.name,
48
- "version": version_from_install_req(install_req),
49
- "markers": str(install_req.markers) or None,
50
- "file": rel_path,
51
- "requirement": str(install_req.specifier) or None,
52
- "extras": sorted(list(install_req.extras))
53
- })
54
- except Exception as e:
55
- print(json.dumps({ "error": repr(e) }))
56
- exit(1)
57
-
58
- return json.dumps({ "result": requirement_packages })
59
-
60
- def parse_setup(directory):
61
- # Parse the setup.py
62
- setup_packages = []
63
- if os.path.isfile(directory + '/setup.py'):
64
- def version_from_install_req(install_req):
65
- if install_req.is_pinned:
66
- return next(iter(install_req.specifier)).version
67
-
68
- def parse_requirement(req, req_type):
69
- install_req = install_req_from_line(req)
70
- if install_req.original_link:
71
- return
72
-
73
- setup_packages.append({
74
- "name": install_req.req.name,
75
- "version": version_from_install_req(install_req),
76
- "markers": str(install_req.markers) or None,
77
- "file": "setup.py",
78
- "requirement": str(install_req.specifier) or None,
79
- "requirement_type": req_type,
80
- "extras": sorted(list(install_req.extras))
81
- })
82
-
83
- def setup(*args, **kwargs):
84
- for arg in ['setup_requires', 'install_requires', 'tests_require']:
85
- if not kwargs.get(arg):
86
- continue
87
- for req in kwargs.get(arg):
88
- parse_requirement(req, arg)
89
- extras_require_dict = kwargs.get('extras_require', {})
90
- for key in extras_require_dict:
91
- for req in extras_require_dict[key]:
92
- parse_requirement(req, 'extras_require:{}'.format(key))
93
- setuptools.setup = setup
94
-
95
- def noop(*args, **kwargs):
96
- pass
97
-
98
- def fake_parse(*args, **kwargs):
99
- return []
100
-
101
- global fake_open
102
- def fake_open(*args, **kwargs):
103
- content = ("VERSION = ('0', '0', '1+dependabot')\n"
104
- "__version__ = '0.0.1+dependabot'\n"
105
- "__author__ = 'someone'\n"
106
- "__title__ = 'something'\n"
107
- "__description__ = 'something'\n"
108
- "__author_email__ = 'something'\n"
109
- "__license__ = 'something'\n"
110
- "__url__ = 'something'\n")
111
- return io.StringIO(content)
112
-
113
- content = open(directory + '/setup.py', 'r').read()
114
-
115
- # Remove `print`, `open`, `log` and import statements
116
- content = re.sub(r"print\s*\(", "noop(", content)
117
- content = re.sub(r"log\s*(\.\w+)*\(", "noop(", content)
118
- content = re.sub(r"\b(\w+\.)*(open|file)\s*\(", "fake_open(", content)
119
- content = content.replace("parse_requirements(", "fake_parse(")
120
- version_re = re.compile(r"^.*import.*__version__.*$", re.MULTILINE)
121
- content = re.sub(version_re, "", content)
122
-
123
- # Set variables likely to be imported
124
- __version__ = '0.0.1+dependabot'
125
- __author__ = 'someone'
126
- __title__ = 'something'
127
- __description__ = 'something'
128
- __author_email__ = 'something'
129
- __license__ = 'something'
130
- __url__ = 'something'
131
-
132
- # Run as main (since setup.py is a script)
133
- __name__ = '__main__'
134
-
135
- # Exec the setup.py
136
- exec(content) in globals(), locals()
137
-
138
- return json.dumps({ "result": setup_packages })
@@ -1,9 +0,0 @@
1
- pip==20.1.1
2
- pip-tools==5.3.0
3
- hashin==0.15.0
4
- pipenv==2018.11.26
5
- pipfile==0.0.2
6
- poetry==1.0.10
7
-
8
- # Some dependencies will only install if Cython is present
9
- Cython==0.29.21
@@ -1,18 +0,0 @@
1
- import sys
2
- import json
3
-
4
- from lib import parser, hasher
5
-
6
- if __name__ == "__main__":
7
- args = json.loads(sys.stdin.read())
8
-
9
- if args["function"] == "parse_requirements":
10
- print(parser.parse_requirements(args["args"][0]))
11
- if args["function"] == "parse_setup":
12
- print(parser.parse_setup(args["args"][0]))
13
- elif args["function"] == "get_dependency_hash":
14
- print(hasher.get_dependency_hash(*args["args"]))
15
- elif args["function"] == "get_pipfile_hash":
16
- print(hasher.get_pipfile_hash(*args["args"]))
17
- elif args["function"] == "get_pyproject_hash":
18
- print(hasher.get_pyproject_hash(*args["args"]))