From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.168.1576271858129765974 for ; Fri, 13 Dec 2019 13:17:38 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: ashley.e.desimone@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2019 13:17:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,311,1571727600"; d="scan'208";a="211557092" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by fmsmga008.fm.intel.com with ESMTP; 13 Dec 2019 13:17:36 -0800 Received: from orsmsx116.amr.corp.intel.com ([169.254.7.30]) by ORSMSX107.amr.corp.intel.com ([169.254.1.58]) with mapi id 14.03.0439.000; Fri, 13 Dec 2019 13:17:36 -0800 From: "Desimone, Ashley E" To: "devel@edk2.groups.io" , "Desimone, Nathaniel L" CC: "Pandya, Puja" Subject: Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo fails to run in detached HEAD mode Thread-Topic: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo fails to run in detached HEAD mode Thread-Index: AQHVru0cqa/XOVK9f06wprQipNS5Cae4l1VQ Date: Fri, 13 Dec 2019 21:17:36 +0000 Message-ID: <4CF3A9EB60ABDA47BE7821A4DA3A0A3353CC68B1@ORSMSX116.amr.corp.intel.com> References: <15DED991CFA1B5F2.29160@groups.io> In-Reply-To: <15DED991CFA1B5F2.29160@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjQ3Y2UwYTMtMTUyYi00OGM3LThhNmItOTI2OWNmYWM2ODNjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiems0TW9ZRVdIRmFqTGIwT3huQU1xSUtSV1RsMFBcL0krclQzUUdMTmZJVXRza054N0FueGlzZzV5dFJIWUhvNkcifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ashley Desimone -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Desi= mone, Nathaniel L Sent: Monday, December 9, 2019 4:02 PM To: devel@edk2.groups.io Cc: Desimone, Ashley E ; Pandya, Puja ; Desimone, Nathaniel L Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo fail= s to run in detached HEAD mode If the current working directory is a git repo, then the EdkRepo entrypoin= t will fail to execute. This is caused by the command_factory being overzea= lous while searching for commands and constructing GitPython objects and se= arching those objects for EdkRepo commands. Cc: Ashley E Desimone Cc: Puja Pandya Signed-off-by: Nathaniel L Desimone --- edkrepo/commands/command_factory.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/edkrepo/commands/command_factory.py b/edkrepo/commands/comman= d_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 =3D=3D '__init__.py' or os.path.splitext(module)[1]= !=3D '.py': continue mod =3D importlib.import_module('{}.{}'.format(cmd_dir[0], os= .path.splitext(module)[0])) + mod_path =3D=20 + os.path.normcase(os.path.normpath(inspect.getfile(mod))) classes =3D inspect.getmembers(mod, predicate=3Dinspect.iscla= ss) for cls in classes: - if _is_command(cls[1]): + in_same_module =3D False + try: + if mod_path =3D=3D os.path.normcase(os.path.normpath(= inspect.getfile(cls[1]))): + in_same_module =3D True + except TypeError: + pass + if in_same_module and _is_command(cls[1]): if cmd_dir[0] =3D=3D pref_cmd_pkg: pref_commands.update([(cls[0], cls[1])]) else: -- 2.20.1