batchfetch 1.0.5__tar.gz → 1.0.6__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.
- {batchfetch-1.0.5 → batchfetch-1.0.6}/PKG-INFO +4 -3
- {batchfetch-1.0.5 → batchfetch-1.0.6}/README.md +3 -2
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch/batchfetch_base.py +2 -1
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch/batchfetch_cli.py +50 -38
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch/batchfetch_git.py +8 -6
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch/helpers.py +4 -2
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch.egg-info/PKG-INFO +4 -3
- {batchfetch-1.0.5 → batchfetch-1.0.6}/setup.py +1 -1
- {batchfetch-1.0.5 → batchfetch-1.0.6}/LICENSE +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch/__init__.py +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch.egg-info/SOURCES.txt +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch.egg-info/dependency_links.txt +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch.egg-info/entry_points.txt +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch.egg-info/requires.txt +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/batchfetch.egg-info/top_level.txt +0 -0
- {batchfetch-1.0.5 → batchfetch-1.0.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: batchfetch
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6
|
|
4
4
|
Summary: Efficiently clone and pull multiple Git repositories.
|
|
5
5
|
Home-page: https://github.com/jamescherti/batchfetch
|
|
6
6
|
Author: James Cherti
|
|
@@ -80,12 +80,13 @@ usage: batchfetch [--option] [args]
|
|
|
80
80
|
|
|
81
81
|
Command line interface.
|
|
82
82
|
|
|
83
|
+
positional arguments:
|
|
84
|
+
N Specify the batchfetch YAML file(s) (default: './batchfetch.yaml').
|
|
85
|
+
|
|
83
86
|
options:
|
|
84
87
|
-h, --help show this help message and exit
|
|
85
88
|
-j JOBS, --jobs JOBS Run up to N Number of parallel processes (Default: 5).
|
|
86
89
|
-v, --verbose Enable verbose mode.
|
|
87
|
-
-f BATCHFETCH_FILE, --batchfetch-file BATCHFETCH_FILE
|
|
88
|
-
Specify the batchfetch YAML file (default: './batchfetch.yaml').
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
## License
|
|
@@ -60,12 +60,13 @@ usage: batchfetch [--option] [args]
|
|
|
60
60
|
|
|
61
61
|
Command line interface.
|
|
62
62
|
|
|
63
|
+
positional arguments:
|
|
64
|
+
N Specify the batchfetch YAML file(s) (default: './batchfetch.yaml').
|
|
65
|
+
|
|
63
66
|
options:
|
|
64
67
|
-h, --help show this help message and exit
|
|
65
68
|
-j JOBS, --jobs JOBS Run up to N Number of parallel processes (Default: 5).
|
|
66
69
|
-v, --verbose Enable verbose mode.
|
|
67
|
-
-f BATCHFETCH_FILE, --batchfetch-file BATCHFETCH_FILE
|
|
68
|
-
Specify the batchfetch YAML file (default: './batchfetch.yaml').
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
## License
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
#
|
|
11
11
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12
12
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14
|
+
# details.
|
|
14
15
|
#
|
|
15
16
|
# You should have received a copy of the GNU General Public License along with
|
|
16
17
|
# this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
#
|
|
11
11
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12
12
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14
|
+
# details.
|
|
14
15
|
#
|
|
15
16
|
# You should have received a copy of the GNU General Public License along with
|
|
16
17
|
# this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -24,7 +25,7 @@ import subprocess
|
|
|
24
25
|
import sys
|
|
25
26
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
26
27
|
from pathlib import Path
|
|
27
|
-
from typing import Any, Dict, Set
|
|
28
|
+
from typing import Any, Dict, Set
|
|
28
29
|
|
|
29
30
|
import colorama
|
|
30
31
|
import yaml # type: ignore
|
|
@@ -48,8 +49,6 @@ class BatchFetchCli:
|
|
|
48
49
|
self._logger = logging.getLogger(self.__class__.__name__)
|
|
49
50
|
self.dirs_relative_to_batchfetch: Set[str] = set()
|
|
50
51
|
|
|
51
|
-
self.main_key = "git"
|
|
52
|
-
|
|
53
52
|
# Plugin
|
|
54
53
|
self.batchfetch_schemas: Dict[Any, Any] = {}
|
|
55
54
|
self.batchfetch_classes: Dict[str, BatchFetchBase] = {}
|
|
@@ -134,17 +133,16 @@ class BatchFetchCli:
|
|
|
134
133
|
print(f"Schema error: {err}.", file=sys.stderr)
|
|
135
134
|
sys.exit(1)
|
|
136
135
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
dest_path = Path(batchfetch_instance["path"]).resolve()
|
|
137
|
+
if str(dest_path) in dict_local_dir:
|
|
138
|
+
err_str = ("More than one task have the " +
|
|
139
|
+
f"destination path '{dest_path}' (" +
|
|
141
140
|
str(task[keyword]) + " and " +
|
|
142
|
-
str(dict_local_dir[
|
|
141
|
+
str(dict_local_dir[(str(dest_path))]) +
|
|
143
142
|
")")
|
|
144
143
|
raise BatchFetchError(err_str)
|
|
145
144
|
|
|
146
|
-
dict_local_dir[
|
|
147
|
-
batchfetch_instance[keyword]
|
|
145
|
+
dict_local_dir[str(dest_path)] = batchfetch_instance[keyword]
|
|
148
146
|
|
|
149
147
|
def run_tasks(self) -> bool:
|
|
150
148
|
failed = []
|
|
@@ -203,7 +201,7 @@ class BatchFetchCli:
|
|
|
203
201
|
return False
|
|
204
202
|
else:
|
|
205
203
|
if num_success == 0:
|
|
206
|
-
print("
|
|
204
|
+
print("Nothing to do.")
|
|
207
205
|
elif not self.verbose:
|
|
208
206
|
print("Success.")
|
|
209
207
|
|
|
@@ -216,6 +214,10 @@ def parse_args():
|
|
|
216
214
|
usage = "%(prog)s [--option] [args]"
|
|
217
215
|
parser = argparse.ArgumentParser(description=desc, usage=usage)
|
|
218
216
|
|
|
217
|
+
parser.add_argument("batchfetch_files", metavar="N", type=str, nargs="*",
|
|
218
|
+
help=("Specify the batchfetch YAML file(s) "
|
|
219
|
+
"(default: './batchfetch.yaml')."))
|
|
220
|
+
|
|
219
221
|
parser.add_argument(
|
|
220
222
|
"-j", "--jobs", default="5", required=False,
|
|
221
223
|
help="Run up to N Number of parallel processes (Default: 5).",
|
|
@@ -226,40 +228,23 @@ def parse_args():
|
|
|
226
228
|
help="Enable verbose mode.",
|
|
227
229
|
)
|
|
228
230
|
|
|
229
|
-
parser.add_argument(
|
|
230
|
-
"-f",
|
|
231
|
-
"--batchfetch-file",
|
|
232
|
-
default="./batchfetch.yaml",
|
|
233
|
-
required=False,
|
|
234
|
-
help="Specify the batchfetch YAML file (default: './batchfetch.yaml').",
|
|
235
|
-
)
|
|
236
|
-
|
|
237
231
|
args = parser.parse_args()
|
|
238
232
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
233
|
+
for batchfetch_file in args.batchfetch_files:
|
|
234
|
+
if not Path(batchfetch_file).is_file():
|
|
235
|
+
print(f"Error: File not found: {batchfetch_file}",
|
|
236
|
+
file=sys.stderr)
|
|
237
|
+
sys.exit(1)
|
|
243
238
|
|
|
244
239
|
return args
|
|
245
240
|
|
|
246
241
|
|
|
247
|
-
def
|
|
248
|
-
"""Command line interface."""
|
|
242
|
+
def run_batchfetch_procedure(batchfetch_file: Path, args) -> int:
|
|
249
243
|
errno = 0
|
|
250
|
-
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
|
|
251
|
-
format="%(asctime)s %(name)s: %(message)s")
|
|
252
|
-
|
|
253
|
-
colorama.init()
|
|
254
|
-
setproctitle(subprocess.list2cmdline([Path(sys.argv[0]).name] +
|
|
255
|
-
sys.argv[1:]))
|
|
256
|
-
|
|
257
|
-
args = parse_args()
|
|
258
244
|
batchfetch_cli = BatchFetchCli(verbose=args.verbose,
|
|
259
245
|
max_workers=int(args.jobs))
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
os.chdir(os.path.dirname(args.batchfetch_file))
|
|
246
|
+
batchfetch_cli.load(batchfetch_file)
|
|
247
|
+
os.chdir(batchfetch_file.parent)
|
|
263
248
|
|
|
264
249
|
try:
|
|
265
250
|
if not batchfetch_cli.run_tasks():
|
|
@@ -271,4 +256,31 @@ def command_line_interface():
|
|
|
271
256
|
print(f"Error: {err}.", file=sys.stderr)
|
|
272
257
|
errno = 1
|
|
273
258
|
|
|
274
|
-
|
|
259
|
+
return errno
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def command_line_interface():
|
|
263
|
+
"""Command line interface."""
|
|
264
|
+
try:
|
|
265
|
+
errno = 0
|
|
266
|
+
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
|
|
267
|
+
format="%(asctime)s %(name)s: %(message)s")
|
|
268
|
+
|
|
269
|
+
colorama.init()
|
|
270
|
+
setproctitle(subprocess.list2cmdline([Path(sys.argv[0]).name] +
|
|
271
|
+
sys.argv[1:]))
|
|
272
|
+
|
|
273
|
+
args = parse_args()
|
|
274
|
+
done = []
|
|
275
|
+
for batchfetch_file in args.batchfetch_files:
|
|
276
|
+
batchfetch_file = Path(batchfetch_file)
|
|
277
|
+
batchfetch_file_resolved = batchfetch_file.resolve()
|
|
278
|
+
if batchfetch_file_resolved in done:
|
|
279
|
+
continue
|
|
280
|
+
|
|
281
|
+
done.append(batchfetch_file_resolved)
|
|
282
|
+
errno |= run_batchfetch_procedure(batchfetch_file, args)
|
|
283
|
+
|
|
284
|
+
sys.exit(errno)
|
|
285
|
+
except BrokenPipeError:
|
|
286
|
+
pass
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
#
|
|
11
11
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12
12
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14
|
+
# details.
|
|
14
15
|
#
|
|
15
16
|
# You should have received a copy of the GNU General Public License along with
|
|
16
17
|
# this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -158,7 +159,7 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
158
159
|
textwrap.indent(err.stderr, " " * self.indent))
|
|
159
160
|
|
|
160
161
|
if not self.is_error() and not self.is_changed():
|
|
161
|
-
self.add_output(self.indent_spaces + "
|
|
162
|
+
self.add_output(self.indent_spaces + "[INFO] Nothing to do.\n")
|
|
162
163
|
|
|
163
164
|
return self.values
|
|
164
165
|
|
|
@@ -175,7 +176,7 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
175
176
|
|
|
176
177
|
def _repo_delete(self):
|
|
177
178
|
if not self.git_local_dir.exists():
|
|
178
|
-
self.add_output(self.indent_spaces + "
|
|
179
|
+
self.add_output(self.indent_spaces + "[INFO] Already deleted\n")
|
|
179
180
|
elif not self.git_local_dir.joinpath(".git").is_dir():
|
|
180
181
|
self.add_output(
|
|
181
182
|
self.indent_spaces +
|
|
@@ -186,7 +187,7 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
186
187
|
elif self.git_local_dir.is_dir():
|
|
187
188
|
shutil.rmtree(str(self.git_local_dir))
|
|
188
189
|
self.add_output(self.indent_spaces +
|
|
189
|
-
f"
|
|
190
|
+
f"[INFO] Deleted: '{self.git_local_dir}'")
|
|
190
191
|
self.set_changed(True)
|
|
191
192
|
|
|
192
193
|
def _repo_clone(self):
|
|
@@ -240,7 +241,7 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
240
241
|
|
|
241
242
|
if ignore_git_pull:
|
|
242
243
|
self.add_output(self.indent_spaces +
|
|
243
|
-
"
|
|
244
|
+
"[INFO] git pull ignored\n")
|
|
244
245
|
else:
|
|
245
246
|
cmd = ["git", "fetch", "origin"]
|
|
246
247
|
self._run(cmd, cwd=str(self.git_local_dir), env=self.env)
|
|
@@ -317,7 +318,8 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
317
318
|
# Update the branch
|
|
318
319
|
self._run(["git", "checkout"] + [self["reference"]],
|
|
319
320
|
cwd=str(self.git_local_dir), env=self.env)
|
|
320
|
-
self.add_output(self.indent_spaces +
|
|
321
|
+
self.add_output(self.indent_spaces +
|
|
322
|
+
"[INFO] Branch changed to " +
|
|
321
323
|
self["reference"] + "\n")
|
|
322
324
|
self.set_changed(True)
|
|
323
325
|
branch_changed = True
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
1
2
|
#
|
|
2
3
|
# Copyright (c) James Cherti
|
|
3
4
|
# URL: https://github.com/jamescherti/batchfetch
|
|
@@ -9,7 +10,8 @@
|
|
|
9
10
|
#
|
|
10
11
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
11
12
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
12
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14
|
+
# details.
|
|
13
15
|
#
|
|
14
16
|
# You should have received a copy of the GNU General Public License along with
|
|
15
17
|
# this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -28,7 +30,7 @@ def md5sum(filename: os.PathLike):
|
|
|
28
30
|
Calculate and return the MD5 checksum of a file.
|
|
29
31
|
|
|
30
32
|
Args:
|
|
31
|
-
filename:
|
|
33
|
+
filename: Path to the file for which the MD5 checksum is calculated.
|
|
32
34
|
|
|
33
35
|
Returns:
|
|
34
36
|
str: The MD5 checksum of the file.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: batchfetch
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6
|
|
4
4
|
Summary: Efficiently clone and pull multiple Git repositories.
|
|
5
5
|
Home-page: https://github.com/jamescherti/batchfetch
|
|
6
6
|
Author: James Cherti
|
|
@@ -80,12 +80,13 @@ usage: batchfetch [--option] [args]
|
|
|
80
80
|
|
|
81
81
|
Command line interface.
|
|
82
82
|
|
|
83
|
+
positional arguments:
|
|
84
|
+
N Specify the batchfetch YAML file(s) (default: './batchfetch.yaml').
|
|
85
|
+
|
|
83
86
|
options:
|
|
84
87
|
-h, --help show this help message and exit
|
|
85
88
|
-j JOBS, --jobs JOBS Run up to N Number of parallel processes (Default: 5).
|
|
86
89
|
-v, --verbose Enable verbose mode.
|
|
87
|
-
-f BATCHFETCH_FILE, --batchfetch-file BATCHFETCH_FILE
|
|
88
|
-
Specify the batchfetch YAML file (default: './batchfetch.yaml').
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
## License
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|