Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] ekeyword: remove .ebuild file suffix requirement (bug 762331)
Date: Tue, 29 Dec 2020 02:04:00
Message-Id: 20201229020338.420774-1-zmedico@gentoo.org
1 We'd like to use ekeyword in a git merge driver implementation, but the
2 files that the driver will pass to ekeyword do not necessarily have a
3 .ebuild suffix. Therefore, it would be handy to be able to distinguish
4 ebuild arguments some other way.
5
6 Bug: https://bugs.gentoo.org/762331
7 Signed-off-by: Zac Medico <zmedico@g.o>
8 ---
9 pym/gentoolkit/ekeyword/ekeyword.py | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-)
11
12 diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py
13 index 4e57c09..665eee5 100755
14 --- a/pym/gentoolkit/ekeyword/ekeyword.py
15 +++ b/pym/gentoolkit/ekeyword/ekeyword.py
16 @@ -244,7 +244,7 @@ def process_content(ebuild, data, ops, arch_status=None, verbose=0,
17 pass
18 else:
19 # Chop the full path and the .ebuild suffix.
20 - disp_name = os.path.basename(ebuild)[:-7]
21 + disp_name, _, _ = os.path.basename(ebuild).partition('.ebuild')
22 def logit(msg):
23 print('%s: %s' % (disp_name, msg))
24
25 @@ -395,7 +395,7 @@ def args_to_work(args, arch_status=None, _repo=None, quiet=0):
26 last_todo_arches = []
27
28 for arg in args:
29 - if arg.endswith('.ebuild'):
30 + if os.path.isfile(arg):
31 if not todo_arches:
32 todo_arches = last_todo_arches
33 work.append([arg, todo_arches])
34 --
35 2.26.2

Replies