[PATCH v2] ekeyword: remove .ebuild file suffix requirement (bug 762331)
Zac Medico <[email protected]> Mon, 28 Dec 2020 19:06:38 -0800
| Newsgroups | gmane.linux.gentoo.portage.devel |
|---|---|
| Message-ID | <[email protected]> |
We'd like to use ekeyword in a git merge driver implementation, but the files that the driver will pass to ekeyword do not necessarily have a .ebuild suffix. Therefore, it would be handy to be able to distinguish ebuild arguments some other way. If the ignorable_arg(arg) function returns True and os.path.isfile(arg) returns True, then simply assume that the argument is an ebuild. Bug: https://bugs.gentoo.org/762331 Signed-off-by: Zac Medico <[email protected]> --- [PATCH v2] fix to respect the ignorable_arg function pym/gentoolkit/ekeyword/ekeyword.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py index 4e57c09..eeceed4 100755 --- a/pym/gentoolkit/ekeyword/ekeyword.py +++ b/pym/gentoolkit/ekeyword/ekeyword.py @@ -244,7 +244,7 @@ def process_content(ebuild, data, ops, arch_status=None, verbose=0, pass else: # Chop the full path and the .ebuild suffix. - disp_name = os.path.basename(ebuild)[:-7] + disp_name, _, _ = os.path.basename(ebuild).partition('.ebuild') def logit(msg): print('%s: %s' % (disp_name, msg)) @@ -395,7 +395,9 @@ def args_to_work(args, arch_status=None, _repo=None, quiet=0): last_todo_arches = [] for arg in args: - if arg.endswith('.ebuild'): + if ignorable_arg(arg, quiet=quiet): + pass + elif os.path.isfile(arg): if not todo_arches: todo_arches = last_todo_arches work.append([arg, todo_arches]) @@ -405,7 +407,7 @@ def args_to_work(args, arch_status=None, _repo=None, quiet=0): op = arg_to_op(arg) if not arch_status or op.arch in arch_status: todo_arches.append(op) - elif not ignorable_arg(arg, quiet=quiet): + else: raise ValueError('unknown arch/argument: %s' % arg) if todo_arches: @@ -475,6 +477,7 @@ def main(argv): opts.style = 'color-inline' arch_status = load_profile_data() + print(arch_status) try: work = args_to_work(work_args, arch_status=arch_status, quiet=opts.quiet) except ValueError as e: -- 2.26.2