aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-12-28 18:00:42 -0800
committerBrian Dolbec <dolsen@gentoo.org>2022-07-09 12:46:35 -0700
commit04e8fd5252c9bc1efad66fdb8cb40d376550d580 (patch)
treeec600fc754a61ab5ab2780598b46cc25bc417d6b /pym/gentoolkit
parentrevdep-rebuild.sh: use awk instead of gawk (diff)
downloadgentoolkit-04e8fd5252c9bc1efad66fdb8cb40d376550d580.tar.gz
gentoolkit-04e8fd5252c9bc1efad66fdb8cb40d376550d580.tar.bz2
gentoolkit-04e8fd5252c9bc1efad66fdb8cb40d376550d580.zip
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>
Diffstat (limited to 'pym/gentoolkit')
-rwxr-xr-xpym/gentoolkit/ekeyword/ekeyword.py8
1 files 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: