commit: 04e8fd5252c9bc1efad66fdb8cb40d376550d580 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Tue Dec 29 02:00:42 2020 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Sat Jul 9 19:46:35 2022 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=04e8fd52
ekeyword: remove .ebuild file suffix requirement (bug 762331) 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 False 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 <zmedico <AT> gentoo.org> Closes: https://github.com/gentoo/gentoolkit/pull/13 Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org> pym/gentoolkit/ekeyword/ekeyword.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py index 7d3a1ef..4d017d4 100755 --- a/pym/gentoolkit/ekeyword/ekeyword.py +++ b/pym/gentoolkit/ekeyword/ekeyword.py @@ -253,7 +253,7 @@ def process_content( 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)) @@ -430,7 +430,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]) @@ -440,7 +442,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:
