From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH v2] ekeyword: remove .ebuild file suffix requirement (bug 762331)
Date: Mon, 28 Dec 2020 19:06:38 -0800 [thread overview]
Message-ID: <20201229030638.424385-1-zmedico@gentoo.org> (raw)
In-Reply-To: <20201229020338.420774-1-zmedico@gentoo.org>
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 True 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>
---
[PATCH v2] fix to respect the ignorable_arg function
pym/gentoolkit/ekeyword/ekeyword.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py
index 4e57c09..eeceed4 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,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])
@@ -405,7 +407,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:
@@ -475,6 +477,7 @@ def main(argv):
opts.style = 'color-inline'
arch_status = load_profile_data()
+ print(arch_status)
try:
work = args_to_work(work_args, arch_status=arch_status, quiet=opts.quiet)
except ValueError as e:
--
2.26.2
prev parent reply other threads:[~2020-12-29 3:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 2:03 [gentoo-portage-dev] [PATCH] ekeyword: remove .ebuild file suffix requirement (bug 762331) Zac Medico
2020-12-29 3:06 ` Zac Medico [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201229030638.424385-1-zmedico@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox