pyallel 1.2.1__tar.gz → 1.2.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyallel
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: Run and handle the output of multiple executables in pyallel (as in parallel)
5
5
  Home-page: https://github.com/Danthewaann/pyallel
6
6
  License: MIT
@@ -141,9 +141,6 @@ python -m venv .venv && \
141
141
  - [x] Add support to have commands depend on other commands (some commands must complete
142
142
  before a given command can start)
143
143
  - [ ] Add a debug mode that logs debug information to a log file
144
- - [ ] Fix wrapping of long commands in the command status line
145
- - [ ] Fix wrapping of very long lines in command output that pushes other commands off the
146
- screen
147
144
  - [ ] Add support to state how many lines a command can use for it's output in interactive mode
148
145
  - [ ] Maybe add support to allow the user to provide stdin for commands that request it
149
146
  (such as a REPL)
@@ -119,9 +119,6 @@ python -m venv .venv && \
119
119
  - [x] Add support to have commands depend on other commands (some commands must complete
120
120
  before a given command can start)
121
121
  - [ ] Add a debug mode that logs debug information to a log file
122
- - [ ] Fix wrapping of long commands in the command status line
123
- - [ ] Fix wrapping of very long lines in command output that pushes other commands off the
124
- screen
125
122
  - [ ] Add support to state how many lines a command can use for it's output in interactive mode
126
123
  - [ ] Maybe add support to allow the user to provide stdin for commands that request it
127
124
  (such as a REPL)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyallel"
3
- version = "1.2.1"
3
+ version = "1.2.3"
4
4
  description = "Run and handle the output of multiple executables in pyallel (as in parallel)"
5
5
  authors = ["Daniel Black <danielcrblack@gmail.com>"]
6
6
  license = "MIT"
@@ -16,7 +16,13 @@ def get_num_lines(output: str, columns: int | None = None) -> int:
16
16
  for line in output.splitlines():
17
17
  line = constants.ANSI_ESCAPE.sub("", line)
18
18
  length = len(line)
19
- lines += 1 * (length // columns + 1 if length > columns else 1)
19
+ line_lines = 1
20
+ if length > columns:
21
+ line_lines = length // columns
22
+ remainder = length % columns
23
+ if remainder:
24
+ line_lines += 1
25
+ lines += 1 * line_lines
20
26
  return lines
21
27
 
22
28
 
@@ -260,40 +266,55 @@ class ProcessGroup:
260
266
 
261
267
  output = ""
262
268
  for i, process in enumerate(self.processes, start=1):
269
+ process_output = ""
263
270
  if process.poll() is not None:
264
271
  self.completed_processes.add(process.id)
265
272
  if process.return_code() != 0:
266
273
  self.passed = False
267
- output += self._get_command_status(
274
+ process_output += self._get_command_status(
268
275
  process,
269
276
  passed=process.return_code() == 0,
270
277
  timer=self.timer,
271
278
  )
272
- output += "\n"
279
+ process_output += "\n"
273
280
  else:
274
- output += self._get_command_status(
281
+ process_output += self._get_command_status(
275
282
  process,
276
283
  icon=constants.ICONS[self.icon],
277
284
  timer=self.timer,
278
285
  )
279
- output += "\n"
286
+ process_output += "\n"
280
287
 
281
- process_output = process.read().decode()
288
+ command_lines = get_num_lines(process_output)
289
+ p_output = process.read().decode()
282
290
  if not self.output[process.id]:
283
291
  self.output[process.id].append("")
284
- self.output[process.id][0] += process_output
285
- process_output = self.output[process.id][0]
286
- if process_output:
292
+ self.output[process.id][0] += p_output
293
+ p_output = self.output[process.id][0]
294
+ p_output_lines = 0
295
+ if p_output:
287
296
  if not all:
288
- process_output = "\n".join(
289
- process_output.splitlines()[-self.process_lines[i - 1] :]
290
- )
291
- process_output += "\n"
292
- output += self._prefix(process_output)
293
- if output and output[-1] != "\n":
294
- output += "\n"
297
+ p_output_lines = p_output.splitlines()[-self.process_lines[i - 1] :]
298
+ p_output = ""
299
+ for line in p_output_lines:
300
+ if len(line) + 3 > constants.COLUMNS():
301
+ p_output += f"{''.join(line[:constants.COLUMNS()-3])}\n"
302
+ else:
303
+ p_output += line + "\n"
304
+ p_output = self._prefix(p_output)
305
+ if p_output and p_output[-1] != "\n":
306
+ p_output += "\n"
295
307
  if i != num_processes:
296
- output += "\n"
308
+ p_output += "\n"
309
+ p_output_lines = get_num_lines(p_output)
310
+
311
+ if not all and (command_lines + p_output_lines) > self.process_lines[i - 1]:
312
+ truncate = (command_lines + p_output_lines) - self.process_lines[i - 1]
313
+ p_output = "\n".join(p_output.splitlines()[truncate:])
314
+ p_output += "\n"
315
+
316
+ process_output += p_output
317
+ output += process_output
297
318
 
298
319
  if self.interrupt_count == 0:
299
320
  return output
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes