We'd like to use ekeyword in a git merge driver implementation (see https://archives.gentoo.org/gentoo-portage-dev/message/ddf7e0285b28ac044e5da7e5ce4fec47), 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. Perhaps os.path.isfile(arg) would be sufficient.
Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/f5db6298065678fbd68b16eb9c0cb060 https://github.com/gentoo/gentoolkit/pull/13
Looks good to me. Go ahead from me.
FWIW, our git merge driver could potentially bypass the argument parsing logic like this: try: ekeyword.process_ebuild(pathname, list(map(ekeyword.arg_to_op, args)) except Exception: result = 1 traceback.print_exc() else: result = 0
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=04e8fd5252c9bc1efad66fdb8cb40d376550d580 commit 04e8fd5252c9bc1efad66fdb8cb40d376550d580 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2020-12-29 02:00:42 +0000 Commit: Brian Dolbec <dolsen@gentoo.org> CommitDate: 2022-07-09 19:46:35 +0000 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@gentoo.org> Closes: https://github.com/gentoo/gentoolkit/pull/13 Signed-off-by: Brian Dolbec <dolsen@gentoo.org> pym/gentoolkit/ekeyword/ekeyword.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)