dependabot-python 0.149.5 → 0.152.1

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: 99f64f19d800af52768e832f794f88f01f36b0c31613cb1a48505beb9716f815
4
- data.tar.gz: f75d7a358f3f24eeccf0bb8b92be358d189817cef1d18b243e1583204cf88d9e
3
+ metadata.gz: d50d8a77fd34baa99882ffa863aac27caab2888c7c7664d8076e4cf198ab0aaf
4
+ data.tar.gz: 984a4b1f278347073b707e6fcd80be3719f699192ac5a86068e0e400cf2a493f
5
5
  SHA512:
6
- metadata.gz: 71c6850e941e6d75735af4cfd294c33201b17c6300e56277e685099afaebae55020e709c89a38e102f2736925707351c88106c5d32c8d02cd50caffb786c1567
7
- data.tar.gz: 84a6d88e44df87e4aade339e37343880b0e38272d1e4a1592e8273327fdef4418ce1e6975140d7dec1afdc5756bb4fdd3b6e6b1735d44df10a5b7ddb76f83c01
6
+ metadata.gz: ad6ff7f27132424c6449f30e80ee5a5cec882811ddb2f7e657746f3acb2e8de4aa0e11cd2b7a32897005723fa3a8645f84e03ddc25c4432464c5384a7dc0ac55
7
+ data.tar.gz: 421ecce05fb09a0591e3dcd37656c4ca059be276e730ea37443c32a2484e1c9f151a33c69bd41d2df0f388a62048da5a1fd911c040099bf3f168e8f79aa63645
data/helpers/build CHANGED
@@ -16,7 +16,6 @@ cp -r \
16
16
  "$install_dir"
17
17
 
18
18
  cd "$install_dir"
19
- PYENV_VERSION=2.7.18 pyenv exec pip install -r "requirements.txt"
20
19
  PYENV_VERSION=3.9.4 pyenv exec pip install -r "requirements.txt"
21
20
 
22
21
  # Workaround of https://github.com/python-poetry/poetry/issues/3010
@@ -1,8 +1,8 @@
1
- pip==20.3.3
2
- pip-tools==5.5.0
1
+ pip==21.1.2
2
+ pip-tools==6.1.0
3
3
  flake8==3.9.2
4
4
  hashin==0.15.0
5
- pipenv==2018.11.26
5
+ pipenv==2021.5.29
6
6
  pipfile==0.0.2
7
7
  poetry==1.1.6
8
8
  wheel==0.36.2
@@ -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 2.7.18
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 two pre-installed versions listed first.
21
+ # the pre-installed versions listed first.
23
22
  SUPPORTED_VERSIONS_TO_ITERATE =
24
23
  [
25
- *PRE_INSTALLED_PYTHON_VERSIONS.select { |v| v.start_with?("3") },
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 = "pip._internal.exceptions.InstallationError: Command errored out with exit status 1"
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
- UNSUPPORTED_DEPS = %w(pyobjc).freeze
39
- UNSUPPORTED_DEP_REGEX =
40
- /"python setup\.py egg_info".*(?:#{UNSUPPORTED_DEPS.join("|")})/.
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
- %r{#{Regexp.quote(PIPENV_INSTALLATION_ERROR)}.+/(?<name>.+)/$}.freeze
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.include?("Could not find a version") ||
155
- error.message.include?("is not a python version")
156
- check_original_requirements_resolvable
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.149.5
4
+ version: 0.152.1
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-02 00:00:00.000000000 Z
11
+ date: 2021-06-11 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.149.5
19
+ version: 0.152.1
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.149.5
26
+ version: 0.152.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement