dependabot-python 0.151.1 → 0.152.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/build +0 -1
- data/helpers/requirements.txt +3 -3
- data/lib/dependabot/python/file_updater/pip_compile_file_updater.rb +1 -27
- data/lib/dependabot/python/file_updater/pipfile_file_updater.rb +0 -28
- data/lib/dependabot/python/python_versions.rb +3 -4
- data/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb +8 -45
- data/lib/dependabot/python/update_checker/pipenv_version_resolver.rb +20 -51
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e1922edaeaf954b6c70d1a18e4a1a89950314b4ef7ab707c85ee4d400898daa
|
4
|
+
data.tar.gz: 47afe48aefccd83ed8c19252f19d24effc248ae8dec6f1b2849bf6c553957478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b9442ce4c7b84a539aad7557ece73a81311913d6ed758f7cfb33dd4b60a2d5947856085de980ef6143da5a604f3ecdd955ac431b1749ba96b758870d031694e
|
7
|
+
data.tar.gz: 2547e1be652cb532fa8ae97825d9986808837c8fcb91ee7bec7b3855a8ec18f90a9b69aeb096ed7b840ebd2f7bd1aa12b7a0c25451e73b945b063f15cdc923b2
|
data/helpers/build
CHANGED
data/helpers/requirements.txt
CHANGED
@@ -170,24 +170,6 @@ module Dependabot
|
|
170
170
|
command,
|
171
171
|
allow_unsafe_shell_command: allow_unsafe_shell_command
|
172
172
|
)
|
173
|
-
rescue SharedHelpers::HelperSubprocessFailed => e
|
174
|
-
original_error ||= e
|
175
|
-
msg = e.message
|
176
|
-
|
177
|
-
relevant_error =
|
178
|
-
if error_suggests_bad_python_version?(msg) then original_error
|
179
|
-
else e
|
180
|
-
end
|
181
|
-
|
182
|
-
raise relevant_error unless error_suggests_bad_python_version?(msg)
|
183
|
-
raise relevant_error if user_specified_python_version
|
184
|
-
raise relevant_error if python_version == "2.7.18"
|
185
|
-
|
186
|
-
@python_version = "2.7.18"
|
187
|
-
retry
|
188
|
-
ensure
|
189
|
-
@python_version = nil
|
190
|
-
FileUtils.remove_entry(".python-version", true)
|
191
173
|
end
|
192
174
|
|
193
175
|
def python_env
|
@@ -205,14 +187,6 @@ module Dependabot
|
|
205
187
|
env
|
206
188
|
end
|
207
189
|
|
208
|
-
def error_suggests_bad_python_version?(message)
|
209
|
-
return true if message.include?("UnsupportedPythonVersion")
|
210
|
-
return true if message.include?("not find a version that satisfies")
|
211
|
-
|
212
|
-
message.include?('Command "python setup.py egg_info" failed') ||
|
213
|
-
message.include?("exit status 1: python setup.py egg_info")
|
214
|
-
end
|
215
|
-
|
216
190
|
def write_updated_dependency_files
|
217
191
|
dependency_files.each do |file|
|
218
192
|
path = file.name
|
@@ -436,7 +410,7 @@ module Dependabot
|
|
436
410
|
def pip_compile_options_from_compiled_file(requirements_file)
|
437
411
|
options = ["--output-file=#{requirements_file.name}"]
|
438
412
|
|
439
|
-
options << "--no-index" unless requirements_file.content.include?("index-url http")
|
413
|
+
options << "--no-emit-index-url" unless requirements_file.content.include?("index-url http")
|
440
414
|
|
441
415
|
options << "--generate-hashes" if requirements_file.content.include?("--hash=sha")
|
442
416
|
|
@@ -264,34 +264,6 @@ module Dependabot
|
|
264
264
|
def run_pipenv_command(command, env: pipenv_env_variables)
|
265
265
|
run_command("pyenv local #{python_version}")
|
266
266
|
run_command(command, env: env)
|
267
|
-
rescue SharedHelpers::HelperSubprocessFailed => e
|
268
|
-
original_error ||= e
|
269
|
-
msg = e.message
|
270
|
-
|
271
|
-
relevant_error =
|
272
|
-
if error_suggests_bad_python_version?(msg) then original_error
|
273
|
-
else e
|
274
|
-
end
|
275
|
-
|
276
|
-
raise relevant_error unless error_suggests_bad_python_version?(msg)
|
277
|
-
raise relevant_error if python_version.start_with?("2")
|
278
|
-
|
279
|
-
# Clear the existing virtualenv, so that we use the new Python version
|
280
|
-
run_command("pyenv local #{python_version}")
|
281
|
-
run_command("pyenv exec pipenv --rm")
|
282
|
-
|
283
|
-
@python_version = "2.7.18"
|
284
|
-
retry
|
285
|
-
ensure
|
286
|
-
@python_version = nil
|
287
|
-
FileUtils.remove_entry(".python-version", true)
|
288
|
-
end
|
289
|
-
|
290
|
-
def error_suggests_bad_python_version?(message)
|
291
|
-
return true if message.include?("UnsupportedPythonVersion")
|
292
|
-
|
293
|
-
message.include?('Command "python setup.py egg_info" failed') ||
|
294
|
-
message.include?("exit status 1: python setup.py egg_info")
|
295
267
|
end
|
296
268
|
|
297
269
|
def write_temporary_dependency_files(pipfile_content)
|
@@ -4,7 +4,7 @@ module Dependabot
|
|
4
4
|
module Python
|
5
5
|
module PythonVersions
|
6
6
|
PRE_INSTALLED_PYTHON_VERSIONS = %w(
|
7
|
-
3.9.4
|
7
|
+
3.9.4
|
8
8
|
).freeze
|
9
9
|
|
10
10
|
# Due to an OpenSSL issue we can only install the following versions in
|
@@ -15,14 +15,13 @@ module Dependabot
|
|
15
15
|
3.7.10 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 3.7.4 3.7.3 3.7.2 3.7.1 3.7.0
|
16
16
|
3.6.13 3.6.12 3.6.11 3.6.10 3.6.9 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3
|
17
17
|
3.6.2 3.6.1 3.6.0 3.5.10 3.5.8 3.5.7 3.5.6 3.5.5 3.5.4 3.5.3
|
18
|
-
2.7.18 2.7.17 2.7.16 2.7.15 2.7.14 2.7.13
|
19
18
|
).freeze
|
20
19
|
|
21
20
|
# This list gets iterated through to find a valid version, so we have
|
22
|
-
# the
|
21
|
+
# the pre-installed versions listed first.
|
23
22
|
SUPPORTED_VERSIONS_TO_ITERATE =
|
24
23
|
[
|
25
|
-
*PRE_INSTALLED_PYTHON_VERSIONS
|
24
|
+
*PRE_INSTALLED_PYTHON_VERSIONS,
|
26
25
|
*SUPPORTED_VERSIONS
|
27
26
|
].freeze
|
28
27
|
end
|
@@ -28,7 +28,8 @@ module Dependabot
|
|
28
28
|
/git clone -q (?<url>[^\s]+).* /.freeze
|
29
29
|
GIT_REFERENCE_NOT_FOUND_REGEX =
|
30
30
|
/egg=(?<name>\S+).*.*WARNING: Did not find branch or tag \'(?<tag>[^\n"]+)\'/m.freeze
|
31
|
-
NATIVE_COMPILATION_ERROR =
|
31
|
+
NATIVE_COMPILATION_ERROR =
|
32
|
+
"pip._internal.exceptions.InstallationSubprocessError: Command errored out with exit status 1:"
|
32
33
|
|
33
34
|
attr_reader :dependency, :dependency_files, :credentials
|
34
35
|
|
@@ -141,18 +142,18 @@ module Dependabot
|
|
141
142
|
return nil
|
142
143
|
end
|
143
144
|
|
144
|
-
if error.message.match?(GIT_DEPENDENCY_UNREACHABLE_REGEX)
|
145
|
-
url = error.message.match(GIT_DEPENDENCY_UNREACHABLE_REGEX).
|
146
|
-
named_captures.fetch("url")
|
147
|
-
raise GitDependenciesNotReachable, url
|
148
|
-
end
|
149
|
-
|
150
145
|
if error.message.match?(GIT_REFERENCE_NOT_FOUND_REGEX)
|
151
146
|
name = error.message.match(GIT_REFERENCE_NOT_FOUND_REGEX).
|
152
147
|
named_captures.fetch("name")
|
153
148
|
raise GitDependencyReferenceNotFound, name
|
154
149
|
end
|
155
150
|
|
151
|
+
if error.message.match?(GIT_DEPENDENCY_UNREACHABLE_REGEX)
|
152
|
+
url = error.message.match(GIT_DEPENDENCY_UNREACHABLE_REGEX).
|
153
|
+
named_captures.fetch("url")
|
154
|
+
raise GitDependenciesNotReachable, url
|
155
|
+
end
|
156
|
+
|
156
157
|
raise
|
157
158
|
end
|
158
159
|
|
@@ -235,35 +236,6 @@ module Dependabot
|
|
235
236
|
def run_pip_compile_command(command)
|
236
237
|
run_command("pyenv local #{python_version}")
|
237
238
|
run_command(command)
|
238
|
-
rescue SharedHelpers::HelperSubprocessFailed => e
|
239
|
-
original_err ||= e
|
240
|
-
msg = e.message
|
241
|
-
|
242
|
-
relevant_error = choose_relevant_error(original_err, e)
|
243
|
-
raise relevant_error unless error_suggests_bad_python_version?(msg)
|
244
|
-
raise relevant_error if user_specified_python_version
|
245
|
-
raise relevant_error if python_version == "2.7.18"
|
246
|
-
|
247
|
-
@python_version = "2.7.18"
|
248
|
-
retry
|
249
|
-
ensure
|
250
|
-
@python_version = nil
|
251
|
-
FileUtils.remove_entry(".python-version", true)
|
252
|
-
end
|
253
|
-
|
254
|
-
def choose_relevant_error(previous_error, new_error)
|
255
|
-
return previous_error if previous_error == new_error
|
256
|
-
|
257
|
-
# If the previous error was definitely due to using the wrong Python
|
258
|
-
# version, return the new error (which can't be worse)
|
259
|
-
return new_error if error_certainly_bad_python_version?(previous_error.message)
|
260
|
-
|
261
|
-
# Otherwise, if the new error may be due to using the wrong Python
|
262
|
-
# version, return the old error (which can't be worse)
|
263
|
-
return previous_error if error_suggests_bad_python_version?(new_error.message)
|
264
|
-
|
265
|
-
# Otherwise, default to the new error
|
266
|
-
new_error
|
267
239
|
end
|
268
240
|
|
269
241
|
def python_env
|
@@ -292,15 +264,6 @@ module Dependabot
|
|
292
264
|
message.include?("SyntaxError")
|
293
265
|
end
|
294
266
|
|
295
|
-
def error_suggests_bad_python_version?(message)
|
296
|
-
return true if error_certainly_bad_python_version?(message)
|
297
|
-
return true if message.include?("not find a version that satisfies")
|
298
|
-
return true if message.include?("No matching distribution found")
|
299
|
-
|
300
|
-
message.include?('Command "python setup.py egg_info" failed') ||
|
301
|
-
message.include?("exit status 1: python setup.py egg_info")
|
302
|
-
end
|
303
|
-
|
304
267
|
def write_temporary_dependency_files(updated_req: nil,
|
305
268
|
update_requirement: true)
|
306
269
|
dependency_files.each do |file|
|
@@ -16,7 +16,6 @@ require "dependabot/python/native_helpers"
|
|
16
16
|
require "dependabot/python/name_normaliser"
|
17
17
|
require "dependabot/python/version"
|
18
18
|
|
19
|
-
# rubocop:disable Metrics/ClassLength
|
20
19
|
module Dependabot
|
21
20
|
module Python
|
22
21
|
class UpdateChecker
|
@@ -35,16 +34,14 @@ module Dependabot
|
|
35
34
|
GIT_REFERENCE_NOT_FOUND_REGEX =
|
36
35
|
%r{git checkout -q (?<tag>[^\n"]+)\n?[^\n]*/(?<name>.*?)(\\n'\]|$)}m.
|
37
36
|
freeze
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
freeze
|
42
|
-
PIPENV_INSTALLATION_ERROR = "pipenv.patched.notpip._internal."\
|
43
|
-
"exceptions.InstallationError: "\
|
44
|
-
"Command \"python setup.py egg_info\" "\
|
45
|
-
"failed with error code 1 in"
|
37
|
+
PIPENV_INSTALLATION_ERROR = "pipenv.patched.notpip._internal.exceptions.InstallationError: Command errored out"\
|
38
|
+
" with exit status 1: python setup.py egg_info"
|
39
|
+
TRACEBACK = "Traceback (most recent call last):"
|
46
40
|
PIPENV_INSTALLATION_ERROR_REGEX =
|
47
|
-
|
41
|
+
/#{Regexp.quote(TRACEBACK)}[\s\S]*^\s+import\s(?<name>.+)[\s\S]*^#{Regexp.quote(PIPENV_INSTALLATION_ERROR)}/.
|
42
|
+
freeze
|
43
|
+
UNSUPPORTED_DEP_REGEX = /(?:pyobjc)[\s\S]*#{Regexp.quote(PIPENV_INSTALLATION_ERROR)}/.freeze
|
44
|
+
PIPENV_RANGE_WARNING = /Warning:\sPython\s[<>].* was not found/.freeze
|
48
45
|
|
49
46
|
attr_reader :dependency, :dependency_files, :credentials
|
50
47
|
|
@@ -151,9 +148,19 @@ module Dependabot
|
|
151
148
|
raise DependencyFileNotResolvable, msg
|
152
149
|
end
|
153
150
|
|
154
|
-
if error.message.
|
155
|
-
|
156
|
-
|
151
|
+
if error.message.match?(PIPENV_RANGE_WARNING)
|
152
|
+
msg = "Pipenv does not support specifying Python ranges "\
|
153
|
+
"(see https://github.com/pypa/pipenv/issues/1050 for more "\
|
154
|
+
"details)."
|
155
|
+
raise DependencyFileNotResolvable, msg
|
156
|
+
end
|
157
|
+
|
158
|
+
check_original_requirements_resolvable if error.message.include?("Could not find a version")
|
159
|
+
|
160
|
+
if error.message.include?("SyntaxError: invalid syntax")
|
161
|
+
raise DependencyFileNotResolvable,
|
162
|
+
"SyntaxError while installing dependencies. Is one of the dependencies not Python 3 compatible? "\
|
163
|
+
"Pip v21 no longer supports Python 2."
|
157
164
|
end
|
158
165
|
|
159
166
|
if (error.message.include?('Command "python setup.py egg_info"') ||
|
@@ -221,13 +228,6 @@ module Dependabot
|
|
221
228
|
raise DependencyFileNotResolvable, msg
|
222
229
|
end
|
223
230
|
|
224
|
-
if error.message.include?("is not a python version")
|
225
|
-
msg = "Pipenv does not support specifying Python ranges "\
|
226
|
-
"(see https://github.com/pypa/pipenv/issues/1050 for more "\
|
227
|
-
"details)."
|
228
|
-
raise DependencyFileNotResolvable, msg
|
229
|
-
end
|
230
|
-
|
231
231
|
if error.message.include?("UnsupportedPythonVersion") &&
|
232
232
|
user_specified_python_requirement
|
233
233
|
msg = clean_error_message(error.message).
|
@@ -465,36 +465,6 @@ module Dependabot
|
|
465
465
|
def run_pipenv_command(command, env: pipenv_env_variables)
|
466
466
|
run_command("pyenv local #{python_version}")
|
467
467
|
run_command(command, env: env)
|
468
|
-
rescue SharedHelpers::HelperSubprocessFailed => e
|
469
|
-
original_error ||= e
|
470
|
-
msg = e.message
|
471
|
-
|
472
|
-
relevant_error =
|
473
|
-
if may_be_using_wrong_python_version?(msg) then original_error
|
474
|
-
else e
|
475
|
-
end
|
476
|
-
|
477
|
-
raise relevant_error unless may_be_using_wrong_python_version?(msg)
|
478
|
-
raise relevant_error if python_version.start_with?("2")
|
479
|
-
|
480
|
-
# Clear the existing virtualenv, so that we use the new Python version
|
481
|
-
run_command("pyenv local #{python_version}")
|
482
|
-
run_command("pyenv exec pipenv --rm")
|
483
|
-
|
484
|
-
@python_version = "2.7.18"
|
485
|
-
retry
|
486
|
-
ensure
|
487
|
-
@python_version = nil
|
488
|
-
FileUtils.remove_entry(".python-version", true)
|
489
|
-
end
|
490
|
-
|
491
|
-
def may_be_using_wrong_python_version?(error_message)
|
492
|
-
return false if user_specified_python_requirement
|
493
|
-
return true if error_message.include?("UnsupportedPythonVersion")
|
494
|
-
return true if error_message.include?("at matches #{dependency.name}")
|
495
|
-
|
496
|
-
error_message.include?('Command "python setup.py egg_info" failed') ||
|
497
|
-
error_message.include?("exit status 1: python setup.py egg_info")
|
498
468
|
end
|
499
469
|
|
500
470
|
def pipenv_env_variables
|
@@ -530,4 +500,3 @@ module Dependabot
|
|
530
500
|
end
|
531
501
|
end
|
532
502
|
end
|
533
|
-
# rubocop:enable Metrics/ClassLength
|
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.
|
4
|
+
version: 0.152.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-10 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.
|
19
|
+
version: 0.152.0
|
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.
|
26
|
+
version: 0.152.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|