1 |
commit: 696b07f1a4411ebdd5b66381ddc986494012785a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 17 11:43:19 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 17 11:43:19 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=696b07f1 |
7 |
|
8 |
pkg-newest-commit: Adjust padding to actual package name lengths |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
pkg-newest-commit.py | 7 ++++++- |
13 |
1 file changed, 6 insertions(+), 1 deletion(-) |
14 |
|
15 |
diff --git a/pkg-newest-commit.py b/pkg-newest-commit.py |
16 |
index ecd5699..ef0af89 100755 |
17 |
--- a/pkg-newest-commit.py |
18 |
+++ b/pkg-newest-commit.py |
19 |
@@ -26,6 +26,11 @@ def main(argv): |
20 |
packages.update('/'.join(x.rsplit('/', 3)[-3:-1]) |
21 |
for x in glob.glob(os.path.join( |
22 |
args.work_dir, cat.strip(), '*/'))) |
23 |
+ if not packages: |
24 |
+ print('No packages specified or found', file=sys.stderr) |
25 |
+ return 1 |
26 |
+ pkg_max_len = max(len(x) for x in packages) |
27 |
+ pkg_format = '{{:.<{}}} {{}} {{}}'.format(pkg_max_len+1) |
28 |
|
29 |
excludes = frozenset([ |
30 |
# specify EAPI=0 explicitly |
31 |
@@ -52,7 +57,7 @@ def main(argv): |
32 |
commit, date = commit_data.split('|') |
33 |
if commit in excludes: |
34 |
continue |
35 |
- print('{:.<65} {} {}'.format(pkg + ' ', date, commit)) |
36 |
+ print(pkg_format.format(pkg + ' ', date, commit)) |
37 |
packages.remove(pkg) |
38 |
if not packages: |
39 |
break |