public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] ekeyword: remove .ebuild file suffix requirement (bug 762331)
@ 2020-12-29  2:03 Zac Medico
  2020-12-29  3:06 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2020-12-29  2:03 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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 <zmedico@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-portage-dev] [PATCH v2] ekeyword: remove .ebuild file suffix requirement (bug 762331)
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2020-12-29  3:06 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-29  3:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-29  2:03 [gentoo-portage-dev] [PATCH] ekeyword: remove .ebuild file suffix requirement (bug 762331) Zac Medico
2020-12-29  3:06 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox