From nobody Sun May 5 18:08:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+52079+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52079+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1575971749; cv=none; d=zohomail.com; s=zohoarc; b=YeFoI5gtRNss0otnDO/lQlwBvdWC9DdaFqz9lGn5XgxEFR7JAbMVvuvNhlTOOy1HSdDlztREZyiUPRvSZ1SXbo0YX+mjlyQaIpBcBkbqJc36831a/nFb5fR0IMFE3ubFzCrAiL9vGlaOyJho4d+/KRwsoLXC5vuoPQhyKZvNogc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575971749; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=EpHAMvbahps+VR0+LcF+fq9pTMjwNEp/IQ4FbFA9WMU=; b=R3GHKZGffvXfHxKC/slAryJis4asUHMcHWfWCNmk/n3Qrs0hS8KOjMg0IFVq6H+Y/AlY8jRkvhhCYRAYiN1DwUnJ+McoxCvFI9EHXYd5PywCOIh5lG3E0Y8U5JtzOPSsw8CHBL7QkZScmHL5umt3z8x0l8YH+PXzPQmnT2dG7b4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52079+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575971749477251.92486389215583; Tue, 10 Dec 2019 01:55:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ug86YY1788612xx7E3pEoCXq; Tue, 10 Dec 2019 01:55:48 -0800 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.7934.1575971747895567159 for ; Tue, 10 Dec 2019 01:55:48 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2019 01:55:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,299,1571727600"; d="scan'208";a="238057217" X-Received: from klmarek-mobl.amr.corp.intel.com ([10.252.198.171]) by fmsmga004.fm.intel.com with ESMTP; 10 Dec 2019 01:55:34 -0800 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Ashley DeSimone , Puja Pandya , Bret Barkelew Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Allow user to override python command Date: Tue, 10 Dec 2019 01:55:01 -0800 Message-Id: <20191210095501.89687-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com X-Gm-Message-State: yvvzZrlgsHxhQozU05QQp3Wax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575971748; bh=XzlJbAvgDlayLHJfck6jV+5+j3sQFxbN0SanqRBvPIw=; h=Cc:Date:From:Reply-To:Subject:To; b=KXKzJ3eCIfCXnCDofjyaaMWZa2tIWqWH7ArzWqCr8DhWL1mz6+ovPWJodrrgVjNITW0 +RlqiufmLcBxLlkNj9pyKMgXh9sdz/gvw4+wD+4XpP+Gc3dUmgY9CTBUgrlEgKEKnSGTU WS+izG443CYAw40l4zXRiqoLWhFd3vZb+Go= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The --py flag will allow the user to specify a specific version of python removing the need for the python3 sym-link on some systems. Cc: Ashley DeSimone Cc: Puja Pandya Cc: Bret Barkelew Signed-off-by: Nate DeSimone Reviewed-by: Ashley DeSimone --- edkrepo_installer/linux-scripts/install.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/edkrepo_installer/linux-scripts/install.py b/edkrepo_installer= /linux-scripts/install.py index a05ce6a..e7d3f91 100755 --- a/edkrepo_installer/linux-scripts/install.py +++ b/edkrepo_installer/linux-scripts/install.py @@ -27,6 +27,7 @@ tool_sign_on =3D 'Installer for edkrepo version {}\nCopyr= ight(c) Intel Corporation cfg_dir =3D '.edkrepo' cfg_src_dir =3D os.path.abspath('config') whl_src_dir =3D os.path.abspath('wheels') +def_python =3D 'python3' def default_run(cmd): return subprocess.run(cmd, universal_newlines=3DTrue, stdout=3Dsubproc= ess.PIPE, stderr=3Dsubprocess.STDOUT, check=3DTrue) @@ -45,6 +46,7 @@ def init_logger(verbose): def get_args(): parser =3D ArgumentParser() parser.add_argument('-l', '--local', action=3D'store_true', default=3D= False, help=3D'Install edkrepo to the user directory instead of system wide= ') + parser.add_argument('-p', '--py', action=3D'store', default=3DNone, he= lp=3D'Specify the python command to use when installing') parser.add_argument('-u', '--user', action=3D'store', default=3DNone, = help=3D'Specify user account to install edkrepo support on') parser.add_argument('-v', '--verbose', action=3D'store_true', default= =3DFalse, help=3D'Enables verbose output') return parser.parse_args() @@ -75,7 +77,7 @@ def get_required_wheels(): 'version':wheel.attrib['V= ersion'], 'install':True} break - pip_cmd =3D ['python3', '-m', 'pip', 'list', '--legacy'] + pip_cmd =3D [def_python, '-m', 'pip', 'list', '--legacy'] try: res =3D default_run(pip_cmd) except: @@ -117,8 +119,14 @@ def _check_version(current, expected): return 0 def do_install(): + global def_python + org_python =3D None + # Parse command line args =3D get_args() + if args.py is not None: + org_python =3D def_python + def_python =3D args.py # Enable logging output log =3D init_logger(args.verbose) @@ -132,6 +140,9 @@ def do_install(): except: log.error('ERROR: Missing installer configuration file.') return 1 + if org_python is not None: + cfg['req_tools'][def_python] =3D cfg['req_tools'][org_python] + cfg['req_tools'].pop(org_python) try: sha_data =3D configparser.ConfigParser(allow_no_value=3DTrue) sha_data.read(os.path.join(cfg_src_dir, 'sha_data.cfg')) @@ -299,13 +310,13 @@ def do_install(): uninstall_whl =3D wheels_to_install[whl_name]['uninstall'] if uninstall_whl: try: - res =3D default_run(['python3', '-m', 'pip', 'uninstal= l', '--yes', whl_name]) + res =3D default_run([def_python, '-m', 'pip', 'uninsta= ll', '--yes', whl_name]) except: log.info('- Failed to uninstall {}'.format(whl_name)) return 1 log.info('+ Uninstalled {}'.format(whl_name)) if install_whl: - install_cmd =3D ['python3', '-m', 'pip', 'install'] + install_cmd =3D [def_python, '-m', 'pip', 'install'] if args.local: install_cmd.append('--user') install_cmd.append(os.path.join(whl_src_dir, whl)) -- 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52079): https://edk2.groups.io/g/devel/message/52079 Mute This Topic: https://groups.io/mt/67968732/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-