dependabot-python 0.151.0 → 0.154.0

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: 0e1ebd5363f48b8aa6700cf2dfeab4bd2f7b641bbb823a6d0f629f7849ba796a
4
- data.tar.gz: 55180e429ff39be0b1ea487067b093e8915499440b49562f26601b3111d0ab3e
3
+ metadata.gz: 96822f8056b88b0fe714b21adaad60b9ece71112181ac6a6eb88a3900954f8f3
4
+ data.tar.gz: 89b411f717f6bf73716d8a7fbfbc4eb2d353b2932dab32fb4ac031b3b634ce25
5
5
  SHA512:
6
- metadata.gz: be2d0d7e8418ead76f5d425ceca90a95de6efb0733d30357ddf0e0245c0fe8c5e89ea0be8d2bf5a8cac442b62b0b96e1efc7f8c7073f00eef211d1cd54e82a87
7
- data.tar.gz: 9b2d1eae918fd4bfbf26ad7264d9ae28e9a6dd62cae88e3e617a50ba8a9f8eab16bc46fd7c1ebda99105ebe800040a46c9b5eceedf567754121a3cc5cb9e0723
6
+ metadata.gz: 1c48907b9bd676958f08be8622af8ffbc75064a65b183436e3fecfbb7893fd4a277c8cf9161eb5e6376abb8194b5e042b9ace6fd79150659a81e9e88ff820f31
7
+ data.tar.gz: ab4d10ca90948cef155a993b85e5a7e42f7c20a2fd85464f123fb715eb0c16d6f0ad7f81569bceffa6f74ef69dba20238b345812c4c4aeaeb676689441f16b4f
data/helpers/build CHANGED
@@ -16,10 +16,9 @@ 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
- PYENV_VERSION=3.9.4 pyenv exec pip install -r "requirements.txt"
19
+ PYENV_VERSION=3.9.5 pyenv exec pip install -r "requirements.txt"
21
20
 
22
21
  # Workaround of https://github.com/python-poetry/poetry/issues/3010
23
22
  # By default poetry config file is stored under ~/.config/pypoetry
24
23
  # and is not bound to any specific Python version
25
- PYENV_VERSION=3.9.4 pyenv exec poetry config experimental.new-installer false
24
+ PYENV_VERSION=3.9.5 pyenv exec poetry config experimental.new-installer false
@@ -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,25 +4,24 @@ 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.5
8
8
  ).freeze
9
9
 
10
10
  # Due to an OpenSSL issue we can only install the following versions in
11
11
  # the Dependabot container.
12
12
  SUPPORTED_VERSIONS = %w(
13
- 3.9.4 3.9.3 3.9.2 3.9.1 3.9.0
14
- 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 3.8.2 3.8.1 3.8.0
13
+ 3.9.5 3.9.4 3.9.3 3.9.2 3.9.1 3.9.0
14
+ 3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 3.8.2 3.8.1 3.8.0
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.151.0
4
+ version: 0.154.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-07 00:00:00.000000000 Z
11
+ date: 2021-06-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.151.0
19
+ version: 0.154.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.151.0
26
+ version: 0.154.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement