From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.11030.1576524037882243435 for ; Mon, 16 Dec 2019 11:20:38 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: puja.pandya@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 11:20:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="217266160" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by orsmga006.jf.intel.com with ESMTP; 16 Dec 2019 11:20:36 -0800 Received: from orsmsx111.amr.corp.intel.com ([169.254.12.24]) by ORSMSX109.amr.corp.intel.com ([169.254.11.176]) with mapi id 14.03.0439.000; Mon, 16 Dec 2019 11:20:36 -0800 From: "Pandya, Puja" To: "devel@edk2.groups.io" , "Desimone, Nathaniel L" CC: "Desimone, Ashley E" 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/XOVK9f06wprQipNS5Cae9Ld3Q Date: Mon, 16 Dec 2019 19:20:36 +0000 Message-ID: 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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzkwNjFhNjMtNjJlZC00MzEzLWE3MGYtNjUwNTA2OTMyYzZmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUTNsaER4ZG9QVWptdlpkV21JdGJUOElWbTZuTWVLVHlEbXhJVmR6c3lxUEtwcmkxcWRJS1lSMXZnVTIrZG94UCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Puja Pandya -----Original Message----- From: devel@edk2.groups.io On Behalf Of Desimone, N= athaniel 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