From: "Pandya, Puja" <puja.pandya@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>
Cc: "Desimone, Ashley E" <ashley.e.desimone@intel.com>
Subject: Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo fails to run in detached HEAD mode
Date: Mon, 16 Dec 2019 19:20:36 +0000 [thread overview]
Message-ID: <E7F6A3AE06A2E44493E1223DCDB89CB641671180@ORSMSX111.amr.corp.intel.com> (raw)
In-Reply-To: <15DED991CFA1B5F2.29160@groups.io>
Reviewed-by: Puja Pandya <puja.pandya@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Desimone, Nathaniel L
Sent: Monday, December 9, 2019 4:02 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E <ashley.e.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo fails to run in detached HEAD mode
If the current working directory is a git repo, then the EdkRepo entrypoint will fail to execute. This is caused by the command_factory being overzealous while searching for commands and constructing GitPython objects and searching those objects for EdkRepo commands.
Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Signed-off-by: Nathaniel L Desimone <nathaniel.l.desimone@intel.com>
---
edkrepo/commands/command_factory.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/edkrepo/commands/command_factory.py b/edkrepo/commands/command_factory.py
index 9f2e923..b607724 100644
--- a/edkrepo/commands/command_factory.py
+++ b/edkrepo/commands/command_factory.py
@@ -61,9 +61,16 @@ def get_commands():
if module == '__init__.py' or os.path.splitext(module)[1] != '.py':
continue
mod = importlib.import_module('{}.{}'.format(cmd_dir[0], os.path.splitext(module)[0]))
+ mod_path =
+ os.path.normcase(os.path.normpath(inspect.getfile(mod)))
classes = inspect.getmembers(mod, predicate=inspect.isclass)
for cls in classes:
- if _is_command(cls[1]):
+ in_same_module = False
+ try:
+ if mod_path == os.path.normcase(os.path.normpath(inspect.getfile(cls[1]))):
+ in_same_module = True
+ except TypeError:
+ pass
+ if in_same_module and _is_command(cls[1]):
if cmd_dir[0] == pref_cmd_pkg:
pref_commands.update([(cls[0], cls[1])])
else:
--
2.20.1
prev parent reply other threads:[~2019-12-16 19:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15DED991CFA1B5F2.29160@groups.io>
2019-12-13 21:17 ` [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo fails to run in detached HEAD mode Desimone, Ashley E
2019-12-16 19:20 ` Pandya, Puja [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-list 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=E7F6A3AE06A2E44493E1223DCDB89CB641671180@ORSMSX111.amr.corp.intel.com \
--to=devel@edk2.groups.io \
/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