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.

Bug: https://bugs.gentoo.org/762331
Signed-off-by: Zac Medico <zmed...@gentoo.org>
---
 pym/gentoolkit/ekeyword/ekeyword.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/ekeyword/ekeyword.py 
b/pym/gentoolkit/ekeyword/ekeyword.py
index 4e57c09..665eee5 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,7 @@ def args_to_work(args, arch_status=None, _repo=None, 
quiet=0):
        last_todo_arches = []
 
        for arg in args:
-               if arg.endswith('.ebuild'):
+               if os.path.isfile(arg):
                        if not todo_arches:
                                todo_arches = last_todo_arches
                        work.append([arg, todo_arches])
-- 
2.26.2


Reply via email to