dependabot-python 0.88.3 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3c6bfe4dfe45325a0e54158029cae720c4983440ecc4c0452d1ba26cc7956c9
4
- data.tar.gz: b177beebec6660a82dea21f61e4061c8bfec37b66de5b21349ac0fe075e4161a
3
+ metadata.gz: aa60d766aec46770ac774666f48efea217f4daa043ccffe85b6a8d605a0fe246
4
+ data.tar.gz: 570b1d8a175ddd4cd2e6134fa1da220de5d25e042e99faa68239ac0feee36c80
5
5
  SHA512:
6
- metadata.gz: 402d90028ad333fada415084d491b2b50900d13171be0498d97e9d8add7e507f1868d4653dfc10e7e02f920472a3138c61754ddf8dfdbe7b6186c1cdadb7a1b2
7
- data.tar.gz: e68f3a6bc15f89fdc12b5c2c1e936d2be84a5977260dc6625932dddeb5eb5c9b542827e8bf8ca6074b7f93da322dde19a1b576e2b47611e5298acecde0d4497e
6
+ metadata.gz: 724f1c44dc595398075215dd168a6c15e02b14e728f92a33e04230f4926acb73273293161f4caaa6ec8f787acbeccae19afb06d9c893181aef4c10bb1501440e
7
+ data.tar.gz: 10e903c17661bed06ede2dc184f789cb3cd2af5c41a6c5098aee9316cef53b46fb1975718040206eb87759187061caf9fc3a78613f2ae3bd2859c317665405ec
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "open3"
3
4
  require "dependabot/python/requirement_parser"
4
5
  require "dependabot/python/file_fetcher"
5
6
  require "dependabot/python/file_updater"
@@ -117,20 +118,24 @@ module Dependabot
117
118
  ).updated_dependency_files
118
119
  end
119
120
 
121
+ # rubocop:disable Metrics/MethodLength
120
122
  def run_command(command)
121
123
  command = command.dup
122
- raw_response = nil
123
- IO.popen(command, err: %i(child out)) do |process|
124
- raw_response = process.read
125
- end
124
+ start = Time.now
125
+ stdout, process = Open3.capture2e(command)
126
+ time_taken = start - Time.now
126
127
 
127
128
  # Raise an error with the output from the shell session if
128
129
  # pip-compile returns a non-zero status
129
- return if $CHILD_STATUS.success?
130
+ return if process.success?
130
131
 
131
132
  raise SharedHelpers::HelperSubprocessFailed.new(
132
- raw_response,
133
- command
133
+ message: stdout,
134
+ error_context: {
135
+ command: command,
136
+ time_taken: time_taken,
137
+ process_exit_value: process.to_s
138
+ }
134
139
  )
135
140
  rescue SharedHelpers::HelperSubprocessFailed => error
136
141
  original_error ||= error
@@ -149,6 +154,7 @@ module Dependabot
149
154
  ensure
150
155
  FileUtils.remove_entry(".python-version", true)
151
156
  end
157
+ # rubocop:enable Metrics/MethodLength
152
158
 
153
159
  def error_suggests_bad_python_version?(message)
154
160
  return true if message.include?("not find a version that satisfies")
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "toml-rb"
4
-
4
+ require "open3"
5
5
  require "dependabot/python/requirement_parser"
6
6
  require "dependabot/python/file_updater"
7
7
  require "dependabot/shared_helpers"
@@ -237,15 +237,23 @@ module Dependabot
237
237
  )
238
238
  end
239
239
 
240
- def run_pipenv_command(cmd)
241
- raw_response = nil
242
- IO.popen(cmd, err: %i(child out)) { |p| raw_response = p.read }
240
+ def run_pipenv_command(command)
241
+ start = Time.now
242
+ stdout, process = Open3.capture2e(command)
243
+ time_taken = start - Time.now
243
244
 
244
245
  # Raise an error with the output from the shell session if Pipenv
245
246
  # returns a non-zero status
246
- return if $CHILD_STATUS.success?
247
-
248
- raise SharedHelpers::HelperSubprocessFailed.new(raw_response, cmd)
247
+ return if process.success?
248
+
249
+ raise SharedHelpers::HelperSubprocessFailed.new(
250
+ message: stdout,
251
+ error_context: {
252
+ command: command,
253
+ time_taken: time_taken,
254
+ process_exit_value: process.to_s
255
+ }
256
+ )
249
257
  rescue SharedHelpers::HelperSubprocessFailed => error
250
258
  original_error ||= error
251
259
  msg = error.message
@@ -256,9 +264,9 @@ module Dependabot
256
264
  end
257
265
 
258
266
  raise relevant_error unless error_suggests_bad_python_version?(msg)
259
- raise relevant_error if cmd.include?("--two")
267
+ raise relevant_error if command.include?("--two")
260
268
 
261
- cmd = cmd.gsub("pipenv ", "pipenv --two ")
269
+ command = command.gsub("pipenv ", "pipenv --two ")
262
270
  retry
263
271
  end
264
272
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "toml-rb"
4
-
4
+ require "open3"
5
5
  require "dependabot/shared_helpers"
6
6
  require "dependabot/python/version"
7
7
  require "dependabot/python/requirement"
@@ -164,15 +164,23 @@ module Dependabot
164
164
  end
165
165
  end
166
166
 
167
- def run_poetry_command(cmd)
168
- raw_response = nil
169
- IO.popen(cmd, err: %i(child out)) { |p| raw_response = p.read }
167
+ def run_poetry_command(command)
168
+ start = Time.now
169
+ stdout, process = Open3.capture2e(command)
170
+ time_taken = start - Time.now
170
171
 
171
172
  # Raise an error with the output from the shell session if Pipenv
172
173
  # returns a non-zero status
173
- return if $CHILD_STATUS.success?
174
-
175
- raise SharedHelpers::HelperSubprocessFailed.new(raw_response, cmd)
174
+ return if process.success?
175
+
176
+ raise SharedHelpers::HelperSubprocessFailed.new(
177
+ message: stdout,
178
+ error_context: {
179
+ command: command,
180
+ time_taken: time_taken,
181
+ process_exit_value: process.to_s
182
+ }
183
+ )
176
184
  end
177
185
 
178
186
  def write_temporary_dependency_files(pyproject_content)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "open3"
3
4
  require "dependabot/python/requirement_parser"
4
5
  require "dependabot/python/file_fetcher"
5
6
  require "dependabot/python/file_parser"
@@ -133,20 +134,24 @@ module Dependabot
133
134
  end
134
135
  end
135
136
 
137
+ # rubocop:disable Metrics/MethodLength
136
138
  def run_command(command)
137
139
  command = command.dup
138
- raw_response = nil
139
- IO.popen(command, err: %i(child out)) do |process|
140
- raw_response = process.read
141
- end
140
+ start = Time.now
141
+ stdout, process = Open3.capture2e(command)
142
+ time_taken = start - Time.now
142
143
 
143
144
  # Raise an error with the output from the shell session if
144
145
  # pip-compile returns a non-zero status
145
- return if $CHILD_STATUS.success?
146
+ return if process.success?
146
147
 
147
148
  raise SharedHelpers::HelperSubprocessFailed.new(
148
- raw_response,
149
- command
149
+ message: stdout,
150
+ error_context: {
151
+ command: command,
152
+ time_taken: time_taken,
153
+ process_exit_value: process.to_s
154
+ }
150
155
  )
151
156
  rescue SharedHelpers::HelperSubprocessFailed => error
152
157
  original_error ||= error
@@ -165,6 +170,7 @@ module Dependabot
165
170
  ensure
166
171
  FileUtils.remove_entry(".python-version", true)
167
172
  end
173
+ # rubocop:enable Metrics/MethodLength
168
174
 
169
175
  def error_suggests_bad_python_version?(message)
170
176
  return true if message.include?("not find a version that satisfies")
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "excon"
4
4
  require "toml-rb"
5
-
5
+ require "open3"
6
6
  require "dependabot/errors"
7
7
  require "dependabot/shared_helpers"
8
8
  require "dependabot/python/file_parser"
@@ -452,17 +452,26 @@ module Dependabot
452
452
  end
453
453
  end
454
454
 
455
- def run_pipenv_command(cmd)
455
+ # rubocop:disable Metrics/MethodLength
456
+ def run_pipenv_command(command)
456
457
  set_up_python_environment
457
458
 
458
- raw_response = nil
459
- IO.popen(cmd, err: %i(child out)) { |p| raw_response = p.read }
459
+ start = Time.now
460
+ stdout, process = Open3.capture2e(command)
461
+ time_taken = start - Time.now
460
462
 
461
463
  # Raise an error with the output from the shell session if Pipenv
462
464
  # returns a non-zero status
463
- return if $CHILD_STATUS.success?
464
-
465
- raise SharedHelpers::HelperSubprocessFailed.new(raw_response, cmd)
465
+ return if process.success?
466
+
467
+ raise SharedHelpers::HelperSubprocessFailed.new(
468
+ message: stdout,
469
+ error_context: {
470
+ command: command,
471
+ time_taken: time_taken,
472
+ process_exit_value: process.to_s
473
+ }
474
+ )
466
475
  rescue SharedHelpers::HelperSubprocessFailed => error
467
476
  original_error ||= error
468
477
  msg = error.message
@@ -477,11 +486,12 @@ module Dependabot
477
486
 
478
487
  @using_python_two = true
479
488
  add_python_two_requirement_to_pipfile
480
- cmd = cmd.gsub("pipenv ", "pipenv --two ")
489
+ command = command.gsub("pipenv ", "pipenv --two ")
481
490
  retry
482
491
  ensure
483
492
  @using_python_two = nil
484
493
  end
494
+ # rubocop:enable Metrics/MethodLength
485
495
 
486
496
  def may_be_using_wrong_python_version?(error_message)
487
497
  return false if python_requirement_specified?
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "excon"
4
4
  require "toml-rb"
5
-
5
+ require "open3"
6
6
  require "dependabot/errors"
7
7
  require "dependabot/shared_helpers"
8
8
  require "dependabot/python/file_parser"
@@ -251,18 +251,21 @@ module Dependabot
251
251
  end
252
252
 
253
253
  def run_poetry_command(command)
254
- raw_response = nil
255
- IO.popen(command, err: %i(child out)) do |process|
256
- raw_response = process.read
257
- end
254
+ start = Time.now
255
+ stdout, process = Open3.capture2e(command)
256
+ time_taken = start - Time.now
258
257
 
259
258
  # Raise an error with the output from the shell session if Pipenv
260
259
  # returns a non-zero status
261
- return if $CHILD_STATUS.success?
260
+ return if process.success?
262
261
 
263
262
  raise SharedHelpers::HelperSubprocessFailed.new(
264
- raw_response,
265
- command
263
+ message: stdout,
264
+ error_context: {
265
+ command: command,
266
+ time_taken: time_taken,
267
+ process_exit_value: process.to_s
268
+ }
266
269
  )
267
270
  end
268
271
 
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.88.3
4
+ version: 0.89.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.88.3
19
+ version: 0.89.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.88.3
26
+ version: 0.89.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement