From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.270.1576272305708195299 for ; Fri, 13 Dec 2019 13:25:05 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: ashley.e.desimone@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2019 13:25:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,311,1571727600"; d="scan'208";a="220997287" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by fmsmga001.fm.intel.com with ESMTP; 13 Dec 2019 13:25:04 -0800 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX102.amr.corp.intel.com (10.22.225.129) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 13 Dec 2019 13:25:04 -0800 Received: from orsmsx116.amr.corp.intel.com ([169.254.7.30]) by ORSMSX159.amr.corp.intel.com ([169.254.11.56]) with mapi id 14.03.0439.000; Fri, 13 Dec 2019 13:25:03 -0800 From: "Desimone, Ashley E" To: "devel@edk2.groups.io" , "Desimone, Nathaniel L" CC: "Pandya, Puja" , "Bjorge, Erik C" , Bret Barkelew Subject: Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Make Python scripts in git_automation executable Thread-Topic: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Make Python scripts in git_automation executable Thread-Index: AQHVsUx5OpGkA109uU+WMMyya3qbF6e4lM1g Date: Fri, 13 Dec 2019 21:25:03 +0000 Message-ID: <4CF3A9EB60ABDA47BE7821A4DA3A0A3353CC68F1@ORSMSX116.amr.corp.intel.com> References: <20191213002953.19726-1-nathaniel.l.desimone@intel.com> In-Reply-To: <20191213002953.19726-1-nathaniel.l.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTEyOTM1YTMtZjFkMy00MWMxLThiMTMtZTMyMzg4ZGIyNTRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicjZPTElRNlBQcVJUa3VJbHJkNEs2Vk9YVWM3SEVTMHhPQVo0a0cxQUhlRkdXR01PTXFnS1wvT3REbHFwVWkwMlkifQ== 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 Return-Path: ashley.e.desimone@intel.com 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 Nate= DeSimone Sent: Thursday, December 12, 2019 4:30 PM To: devel@edk2.groups.io Cc: Desimone, Ashley E ; Pandya, Puja ; Bjorge, Erik C ; Bret Barkelew <= Bret.Barkelew@microsoft.com> Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Make Python = scripts in git_automation executable Scripts in the git_automation folder need to be executable so that git can= invoke them as editor commands. Cc: Ashley DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Signed-off-by: Nate DeSimone --- edkrepo_installer/linux-scripts/install.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/edkrepo_installer/linux-scripts/install.py b/edkrepo_installe= r/linux-scripts/install.py index a05ce6a..e0f57b2 100755 --- a/edkrepo_installer/linux-scripts/install.py +++ b/edkrepo_installer/linux-scripts/install.py @@ -15,6 +15,7 @@ import importlib.util import logging import os import platform +import stat import shutil import subprocess import sys @@ -25,6 +26,7 @@ tool_sign_on =3D 'Installer for edkrepo version {}\nCopy= right(c) Intel Corporation # Data here should be maintained in a configuration file cfg_dir =3D '.e= dkrepo' +directories_with_executables =3D ['git_automation'] cfg_src_dir =3D os.path.abspath('config') whl_src_dir =3D os.path.abspat= h('wheels') @@ -116,6 +118,27 @@ def _check_version(current, expected): return 1 return 0 +def get_site_packages_directory(): + res =3D default_run([def_python, '-c', 'import site; print(site.getsi= tepackages()[0])']) + return res.stdout.strip() + +def set_execute_permissions(): + site_packages =3D get_site_packages_directory() + config =3D configparser.ConfigParser(allow_no_value=3DTrue, delimiter= s=3D'=3D') + config.read(os.path.join(cfg_src_dir, 'edkrepo.cfg')) + command_packages =3D [x.strip() for x in config['command-packages']['= packages'].split('|')] + for command_package in command_packages: + package_dir =3D os.path.join(site_packages, command_package.split= ('.')[0]) + for directory in directories_with_executables: + full_path =3D os.path.join(package_dir, directory) + if os.path.isdir(full_path): + for py_file in os.listdir(full_path): + if py_file =3D=3D '__init__.py' or os.path.splitext(p= y_file)[1] !=3D '.py': + continue + py_file =3D os.path.join(full_path, py_file) + stat_data =3D os.stat(py_file) + os.chmod(py_file, stat_data.st_mode | stat.S_IEXEC) + def do_install(): # Parse command line args =3D get_args() @@ -316,6 +339,10 @@ def do_install(): return 1 log.info('+ Installed {}'.format(whl_name)) + #Mark scripts as executable + set_execute_permissions() + log.info('+ Marked scripts as executable') + log.log(logging.PRINT, '\nInstallation complete\n') return 0 -- 2.20.1