pyallel 1.2.0__tar.gz → 1.2.1__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.0
3
+ Version: 1.2.1
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
@@ -98,28 +98,52 @@ You can also build an executable with the following (executables will be written
98
98
  > The `arch=x86_64` values in the following code blocks can be replaced with `arch=aarch64` and
99
99
  > any other architecture that is supported by docker to build an executable for that given architecture
100
100
 
101
+ > [!NOTE]
102
+ > To build aarch64 binaries on an x86_64 host machine, you will need to run the following
103
+ > commands to setup qemu to allow this to work
104
+
105
+ ```bash
106
+ sudo apt-get install qemu binfmt-support qemu-user-static && \
107
+ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
108
+ ```
109
+
101
110
  #### Build for generic linux
102
111
 
103
112
  ```bash
104
- docker build --tag pyallel --build-arg 'arch=x86_64' . && docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel
113
+ docker build --tag pyallel --build-arg 'arch=x86_64' --build-arg "uid=$(id -u)" . && \
114
+ docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel
105
115
  ```
106
116
 
107
117
  #### Build for alpine linux
108
118
 
109
119
  ```bash
110
- docker build --tag pyallel-alpine --build-arg 'arch=x86_64' --file Dockerfile.alpine . && docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel-alpine
120
+ docker build --tag pyallel-alpine --build-arg 'arch=x86_64' --build-arg "uid=$(id -u)" --file Dockerfile.alpine . && \
121
+ docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel-alpine
111
122
  ```
112
123
 
113
124
  #### Build locally
114
125
 
115
126
  ```bash
116
- python -m venv .venv && source .venv/bin/activate && pip install . -r requirements_build.txt && ./build.sh
127
+ python -m venv .venv && \
128
+ source .venv/bin/activate && \
129
+ pip install . -r requirements_build.txt && \
130
+ ./build.sh
131
+ ```
132
+
133
+ #### Build all
134
+
135
+ ```bash
136
+ ./build_all.sh
117
137
  ```
118
138
 
119
139
  ## TODOs
120
140
 
121
141
  - [x] Add support to have commands depend on other commands (some commands must complete
122
142
  before a given command can start)
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
123
147
  - [ ] Add support to state how many lines a command can use for it's output in interactive mode
124
148
  - [ ] Maybe add support to allow the user to provide stdin for commands that request it
125
149
  (such as a REPL)
@@ -76,28 +76,52 @@ You can also build an executable with the following (executables will be written
76
76
  > The `arch=x86_64` values in the following code blocks can be replaced with `arch=aarch64` and
77
77
  > any other architecture that is supported by docker to build an executable for that given architecture
78
78
 
79
+ > [!NOTE]
80
+ > To build aarch64 binaries on an x86_64 host machine, you will need to run the following
81
+ > commands to setup qemu to allow this to work
82
+
83
+ ```bash
84
+ sudo apt-get install qemu binfmt-support qemu-user-static && \
85
+ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
86
+ ```
87
+
79
88
  #### Build for generic linux
80
89
 
81
90
  ```bash
82
- docker build --tag pyallel --build-arg 'arch=x86_64' . && docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel
91
+ docker build --tag pyallel --build-arg 'arch=x86_64' --build-arg "uid=$(id -u)" . && \
92
+ docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel
83
93
  ```
84
94
 
85
95
  #### Build for alpine linux
86
96
 
87
97
  ```bash
88
- docker build --tag pyallel-alpine --build-arg 'arch=x86_64' --file Dockerfile.alpine . && docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel-alpine
98
+ docker build --tag pyallel-alpine --build-arg 'arch=x86_64' --build-arg "uid=$(id -u)" --file Dockerfile.alpine . && \
99
+ docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel-alpine
89
100
  ```
90
101
 
91
102
  #### Build locally
92
103
 
93
104
  ```bash
94
- python -m venv .venv && source .venv/bin/activate && pip install . -r requirements_build.txt && ./build.sh
105
+ python -m venv .venv && \
106
+ source .venv/bin/activate && \
107
+ pip install . -r requirements_build.txt && \
108
+ ./build.sh
109
+ ```
110
+
111
+ #### Build all
112
+
113
+ ```bash
114
+ ./build_all.sh
95
115
  ```
96
116
 
97
117
  ## TODOs
98
118
 
99
119
  - [x] Add support to have commands depend on other commands (some commands must complete
100
120
  before a given command can start)
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
101
125
  - [ ] Add support to state how many lines a command can use for it's output in interactive mode
102
126
  - [ ] Maybe add support to allow the user to provide stdin for commands that request it
103
127
  (such as a REPL)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyallel"
3
- version = "1.2.0"
3
+ version = "1.2.1"
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"
@@ -5,7 +5,7 @@ import sys
5
5
  IN_TTY = sys.stdout.isatty()
6
6
  CLEAR_LINE = "\033[2K"
7
7
  UP_LINE = "\033[1F"
8
- ANSI_ESCAPE = re.compile(r"(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]")
8
+ ANSI_ESCAPE = re.compile(r"(\x9B|\x1B\[|\x1B\()[0-?]*[ -\/]*[@-~]")
9
9
 
10
10
  if IN_TTY:
11
11
 
@@ -70,7 +70,3 @@ class Process:
70
70
  if self._process:
71
71
  return self._process.wait()
72
72
  return -1
73
-
74
- @classmethod
75
- def from_command(cls, id: int, command: str) -> Process:
76
- return cls(id=id, command=command)
@@ -41,6 +41,9 @@ class ProcessGroup:
41
41
  icon: int = 0
42
42
  colours: Colours = field(default_factory=Colours)
43
43
 
44
+ def __post_init__(self) -> None:
45
+ self.process_lines = [0 for _ in self.processes]
46
+
44
47
  def stream(self) -> int:
45
48
  for process in self.processes:
46
49
  process.run()
@@ -227,7 +230,7 @@ class ProcessGroup:
227
230
 
228
231
  for i, command in enumerate(commands):
229
232
  try:
230
- processes.append(Process.from_command(i + 1, command))
233
+ processes.append(Process(i + 1, command))
231
234
  except InvalidExecutableError as e:
232
235
  errors.append(e)
233
236
 
@@ -243,18 +246,13 @@ class ProcessGroup:
243
246
 
244
247
  return process_group
245
248
 
246
- def complete_output(self, tail: int = 20, all: bool = False) -> str:
249
+ def complete_output(self, all: bool = False) -> str:
247
250
  num_processes = len(self.processes)
248
251
  lines = constants.LINES() - (2 * num_processes)
249
252
  remainder = lines % num_processes
250
253
  tail = lines // num_processes
251
-
252
- if self.process_lines:
253
- self.process_lines = []
254
-
255
- for process in self.processes:
256
- self.process_lines.append(tail)
257
-
254
+ for i in range(num_processes):
255
+ self.process_lines[i] = tail
258
256
  if remainder:
259
257
  self.process_lines[-1] += remainder - 2
260
258
  else:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes