From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.95]) by mx.groups.io with SMTP id smtpd.web12.3905.1584647063579905487 for ; Thu, 19 Mar 2020 12:44:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=cazGDB/U; spf=pass (domain: microsoft.com, ip: 40.107.93.95, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W9LEDqQur3YCXB6TWD3CA8tCJiVFr3KRQ1T2yyzbfSkHF9Skv3aToj07tPTCUAqRuCWfGD96mLAvh6h7nGcUPu81qZzvdhvRZAWB+fhLej/bY3IR4qANcqU2K2vwYshDbPPQT/2obcra6HpctPb1WH9/cWZReAni8cakPqC13Pvx+pfjKezKoz4TeBZi+ZZHJxDSTJGWIkj+NZBhDw6sJwuydZc1We08RhGArYKo+ufxMAnQ2bezX/wbagsMxMUQMkqPxjb873P9+9Lrggf8ztD3Fyj1cTf7BuHyUuvLWzKn5iZbYa/9Rs5aqbEE1l42DbJ45ROt+slmAlXlRwwu1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=siPl+MRPDMnwK6Aiu/jAWA8+fC0d8YhEqpxkPkXihWY=; b=n7WmeptjXdJCcEHdI9mhQh1EWPaDGHPSoR+CYyv0y6dvQXnJQ8O4OBb9XAn8rtn2JV5pKG5A13iCD2p0SFog+vusgaDYNCyc/BkoFvjRQgSxsvj+qEf/Jh1NFGQoNszrT9kGidnq4c1F8tJjQlmiSx9VzfiZ7ZAdSgICMoQVNiGTuTSsQzTjDSr330rSbqwqqqCtGx8n79uBNRePoZaAIXon5nyUrHM9YjVDncRbgG9rAiLfC7uzsDruit2U8T/xCQE3F12JQaCKpTKEO6zefwJFTg4qRv7enWmctcii1XkvfBRhmnLWZyYbQtodEUnQhzBElgiDdpHethrWO9RNFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=siPl+MRPDMnwK6Aiu/jAWA8+fC0d8YhEqpxkPkXihWY=; b=cazGDB/U70vx7fw1VW3Gmya6FfIQTRIOtHiJZBHAaTGkvURpD4/l31Isi8jH4ory6Mmrz8AZn8ktsc202ghg3cALUtewlSiTUXqINUGT7m9clefn7zucg4yDF9ykpV7ENEq3wc+Y6Vqb7tMAHQ8MIz7+bq3iZxZbvz9VKjoNt5A= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0792.namprd21.prod.outlook.com (2603:10b6:903:13b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.8; Thu, 19 Mar 2020 19:44:21 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::9118:22ef:23c:d0ab]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::9118:22ef:23c:d0ab%9]) with mapi id 15.20.2835.013; Thu, 19 Mar 2020 19:44:21 +0000 From: "Bret Barkelew" To: "Desimone, Ashley E" , "Desimone, Nathaniel L" , "devel@edk2.groups.io" CC: "Pandya, Puja" , "Bjorge, Erik C" Subject: Re: [PATCH 1/4] EdkRepo: Installer should remove obsolete dependencies Thread-Topic: [PATCH 1/4] EdkRepo: Installer should remove obsolete dependencies Thread-Index: AQHV/iUrXu8o79TTu0KXeglfeefZm6hQURDs Date: Thu, 19 Mar 2020 19:44:21 +0000 Message-ID: References: <20200319031636.2269-1-nathaniel.l.desimone@intel.com> <20200319031636.2269-2-nathaniel.l.desimone@intel.com>,<4CF3A9EB60ABDA47BE7821A4DA3A0A3353D5B3EA@ORSMSX116.amr.corp.intel.com> In-Reply-To: <4CF3A9EB60ABDA47BE7821A4DA3A0A3353D5B3EA@ORSMSX116.amr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-03-19T19:43:34.7400074Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bret.Barkelew@microsoft.com; x-originating-ip: [71.212.145.195] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8be021b6-a3bb-42f4-a6fc-08d7cc3debe4 x-ms-traffictypediagnostic: CY4PR21MB0792: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0347410860 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(39860400002)(136003)(396003)(366004)(346002)(376002)(199004)(86362001)(66446008)(52536014)(64756008)(66574012)(8676002)(54906003)(53546011)(33656002)(7696005)(8936002)(110136005)(6506007)(478600001)(10290500003)(81156014)(81166006)(5660300002)(76116006)(66476007)(91956017)(66556008)(66946007)(316002)(2906002)(186003)(8990500004)(9686003)(26005)(71200400001)(55016002)(4326008);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0792;H:CY4PR21MB0743.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QH096gUUcQVnPK0wdzIHBvnageRYwvwh7Q7SSPgn7AdF0ioCKDahd5kn4RLL1g1dtNQMbJgefOwquUslYz5RAwBgcmwfA8392bSngSyAzuz3Uq++djyZnxzuwqLSepXZXNg90LsIXnrfrTHidP//lvLhj3jUmfIiihpRm8Y6pqX3j7U/F674DMeOJlt2Ug0wMaAQMAXbN7Anxx5RspL9nElUBIDiTV3AfT/Rz5e6W4uoLvoznkzh3R6GCe0q1uY6BpFqzQmNSfb755axeTfsLgOcy1NusAMC6RnpHFRWj2ykoTzjhp/QZbtGqtHK8sPnodj8LIlIbAWRkJUG+tjzAShGsiEqEnipufQrsbS0t57vdaoIoDq0kBa9ofkgFdtHobM9oSp7KH882hgBu5gLXSfLTfHNyNsamH3dN8IciCN+Dlp3JUq+yTi3WpL/5ugE x-ms-exchange-antispam-messagedata: 4n2R6oR1AdE90wMI79T5/JazALasy55T6aH0NzJ3zLy0pkeneY7+OgNKS0IznexuYMafvGlJ6nJYmGL9QIcu9Az/oB+zEpajBPwQinlkziNEwKyjbL+KeCIi/AAVmUu8SWVD/ioWrP8x4DuA+y8Y2Q== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8be021b6-a3bb-42f4-a6fc-08d7cc3debe4 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2020 19:44:21.7597 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: spPgBM51EGLoeaDSJS6nJKLXHptT8rN1EVz+7lXG3Z6pW+asH1MkCZvaB0ZLSZDOYhNYBovR8hBsT6CIhjdx+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0792 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB074359B437B9A38717AE4FF1EFF40CY4PR21MB0743namp_" --_000_CY4PR21MB074359B437B9A38717AE4FF1EFF40CY4PR21MB0743namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Na=EFve question: why isn=92t this upgrade handled when pip installs the ne= w wheel? Are the dependencies not matched up correctly? I would think that = pip would uninstall the old version on its own. - Bret From: Desimone, Ashley E Sent: Thursday, March 19, 2020 12:32 PM To: Desimone, Nathaniel L; devel@edk= 2.groups.io Cc: Pandya, Puja; Bjorge, Erik C; Bret Barkelew Subject: [EXTERNAL] RE: [PATCH 1/4] EdkRepo: Installer should remove obsole= te dependencies For the following section why are we singling out gitdb2 and smmap2 when de= leting obsolete dependencies? Is there an alternative to hardcoding these v= alues? + if (DeleteObsoletePackages) + { + // + // Delete obsolete dependencies + // + foreach (string PackageName in new string[] { "smmap2"= , "gitdb2" }) + { + if (InstalledPackages.Where(p =3D> p.Name =3D=3D P= ackageName).FirstOrDefault() !=3D null) + { + InstallLogger.Log(string.Format("Uninstalling = {0}", PackageName)); + PythonOperations.UninstallPythonPackage(Python= Path, PackageName); + } + } + } Thanks, Ashley -----Original Message----- From: Desimone, Nathaniel L Sent: Wednesday, March 18, 2020 8:17 PM To: devel@edk2.groups.io Cc: Desimone, Ashley E ; Pandya, Puja ; Bjorge, Erik C ; Bret Barkelew Subject: [PATCH 1/4] EdkRepo: Installer should remove obsolete dependencies Cc: Ashley DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Signed-off-by: Nate DeSimone --- .../EdkRepoInstaller/InstallWorker.cs | 30 +++++++++- edkrepo_installer/linux-scripts/install.py | 58 ++++++++++++------- 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/edkrepo_installer/EdkRepoInstaller/InstallWorker.cs b/edkrepo_= installer/EdkRepoInstaller/InstallWorker.cs index 8d824f2..b44e8fa 100644 --- a/edkrepo_installer/EdkRepoInstaller/InstallWorker.cs +++ b/edkrepo_installer/EdkRepoInstaller/InstallWorker.cs @@ -710,6 +710,7 @@ namespace TianoCore.EdkRepoInstaller string PythonPath; bool Has32Bit; bool Has64Bit; + bool DeleteObsoletePackages =3D false; PythonOperations.GetPythonBitness(PyInstance.Version.Major= , PyInstance.Version.Minor, out Has32Bit, out Has64Bit); if (Has32Bit && Has64Bit && PyInstance.Architecture =3D=3D= CpuArchitecture.IA32) { @@ -720,14 +721,39 @@ namespace TianoCore.EdkRepoInstaller PythonPath =3D PythonOperations.FindPython(PyInstance.= Version.Major, PyInstance.Version.Minor, false); } List InstalledPackages =3D PythonOperations= .GetInstalledPythonPackages(PythonPath); - foreach(PythonWheel Wheel in PyInstance.Wheels) + foreach (PythonWheel Wheel in PyInstance.Wheels) + { + //If a package is already installed, check if we have = a newer version bundled in the installer + //If yes, the package will be upgraded, make sure obso= lete packages are uninstalled first + PythonPackage InstalledPackage =3D InstalledPackages.W= here(p =3D> p.Name =3D=3D Wheel.Package.Name.Replace('_', '-')).FirstOrDefa= ult(); + if (InstalledPackage !=3D null && InstalledPackage.Ver= sion < Wheel.Package.Version) + { + DeleteObsoletePackages =3D true; + break; + } + } + if (DeleteObsoletePackages) + { + // + // Delete obsolete dependencies + // + foreach (string PackageName in new string[] { "smmap2"= , "gitdb2" }) + { + if (InstalledPackages.Where(p =3D> p.Name =3D=3D P= ackageName).FirstOrDefault() !=3D null) + { + InstallLogger.Log(string.Format("Uninstalling = {0}", PackageName)); + PythonOperations.UninstallPythonPackage(Python= Path, PackageName); + } + } + } + foreach (PythonWheel Wheel in PyInstance.Wheels) { //PythonPackage InstalledPackage =3D (from package in = InstalledPackages // where package.Name= =3D=3D Wheel.Package.Name // select package).Fi= rstOrDefault(); //If the package is already installed, check if we hav= e a newer version bundled in the installer //If so, upgrade the package - PythonPackage InstalledPackage =3D InstalledPackages.W= here(p =3D> p.Name =3D=3D Wheel.Package.Name).FirstOrDefault(); + PythonPackage InstalledPackage =3D + InstalledPackages.Where(p =3D> p.Name =3D=3D Wheel.Package.Name.Replace('= _', + '-')).FirstOrDefault(); if (InstalledPackage !=3D null) { if (InstalledPackage.Version < Wheel.Package.Versi= on) diff --git a/edkrepo_installer/linux-scripts/install.py b/edkrepo_insta= ller/linux-scripts/install.py index 0ea486d..b2cdfed 100755 --- a/edkrepo_installer/linux-scripts/install.py +++ b/edkrepo_installer/linux-scripts/install.py @@ -3,7 +3,7 @@ ## @file # install.py # -# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2020, Intel Corporation. All rights +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -53,6 +53,26 @@ def get_args(): parser.add_argument('-v', '--verbose', action=3D'store_true', default= =3DFalse, help=3D'Enables verbose output') return parser.parse_args() +def get_installed_packages(python_command): + pip_cmd =3D [def_python, '-m', 'pip', 'list', '--legacy'] + try: + res =3D default_run(pip_cmd) + except: + pip_cmd.pop(-1) + try: + res =3D default_run(pip_cmd) + except: + return ret_val + installed_packages =3D {} + for pip_mod in res.stdout.split('\n'): + try: + name, version =3D pip_mod.split() + version =3D version.strip().strip('()') + except: + continue + installed_packages[name] =3D version + return installed_packages + def get_required_wheels(): ret_val =3D collections.OrderedDict() if platform.machine() =3D=3D 'x86_64': @@ -79,27 +99,11 @@ def get_required_wheels(): 'version':wheel.attrib['V= ersion'], 'install':True} break - pip_cmd =3D [def_python, '-m', 'pip', 'list', '--legacy'] - try: - res =3D default_run(pip_cmd) - except: - pip_cmd.pop(-1) - try: - res =3D default_run(pip_cmd) - except: - return ret_val - installed_modules =3D {} - for pip_mod in res.stdout.split('\n'): - try: - name, version =3D pip_mod.split() - version =3D version.strip().strip('()') - except: - continue - installed_modules[name] =3D version + installed_packages =3D get_installed_packages(def_python) for name in ret_val: #pip doesn't understand the difference between '_' and '-' - if name.replace('_','-') in installed_modules: - version =3D installed_modules[name.replace('_','-')] + if name.replace('_','-') in installed_packages: + version =3D installed_packages[name.replace('_','-')] if _check_version(version, ret_val[name]['version']) >=3D 0 an= d not ret_val[name]['uninstall']: ret_val[name]['install'] =3D False else: @@ -328,16 +332,30 @@ def do_install(): if not os.path.isdir(whl_src_dir): log.info('- Missing wheel file directory') return 1 + updating_edkrepo =3D False for whl_name in wheels_to_install: uninstall_whl =3D wheels_to_install[whl_name]['uninstall'] whl_name =3D whl_name.replace('_','-') #pip doesn't understan= d the difference between '_' and '-' if uninstall_whl: + updating_edkrepo =3D True try: 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)) + + #Delete obsolete dependencies + if updating_edkrepo: + installed_packages =3D get_installed_packages(def_python) + for whl_name in ['smmap2', 'gitdb2']: + if whl_name in installed_packages: + try: + res =3D default_run([def_python, '-m', 'pip', 'uni= nstall', '--yes', whl_name]) + except: + log.info('- Failed to uninstall {}'.format(whl_nam= e)) + return 1 + log.info('+ Uninstalled {}'.format(whl_name)) for whl_name in wheels_to_install: whl =3D wheels_to_install[whl_name]['wheel'] install_whl =3D wheels_to_install[whl_name]['install'] -- 2.24.0.windows.2 --_000_CY4PR21MB074359B437B9A38717AE4FF1EFF40CY4PR21MB0743namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Na=EFve question: why isn=92t this upgrade handled w= hen pip installs the new wheel? Are the dependencies not matched up correct= ly? I would think that pip would uninstall the old version on its own.

 

- Bret

 

From: Desimone, Ashley E
Sent: Thursday, March 19, 2020 12:32 PM
To: Desimone, Nath= aniel L; devel@edk2.groups.io
Cc: Pandya, Puja; Bjorge, Erik C; Bret Bar= kelew
Subject: [EXTERNAL] RE: [PATCH 1/4] EdkRepo: Installer should remove= obsolete dependencies

 

For the following sec= tion why are we singling out gitdb2 and smmap2 when deleting obsolete depen= dencies? Is there an alternative to hardcoding these values?

+           &nbs= p;    if (DeleteObsoletePackages)
+           &nbs= p;    {
+           &nbs= p;        //
+           &nbs= p;        // Delete obsolete dependencie= s
+           &nbs= p;        //
+           &nbs= p;        foreach (string PackageName in= new string[] { "smmap2", "gitdb2" })
+           &nbs= p;        {
+           &nbs= p;            if (In= stalledPackages.Where(p =3D> p.Name =3D=3D PackageName).FirstOrDefault()= !=3D null)
+           &nbs= p;            {
+           &nbs= p;            &= nbsp;   InstallLogger.Log(string.Format("Uninstalling {0}&qu= ot;, PackageName));
+           &nbs= p;            &= nbsp;   PythonOperations.UninstallPythonPackage(PythonPath, Packa= geName);
+           &nbs= p;            }
+           &nbs= p;        }
+           &nbs= p;    }

Thanks,
Ashley

-----Original Message-----
From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Sent: Wednesday, March 18, 2020 8:17 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E <ashley.e.desimone@intel.com>; Pandya, Puja &l= t;puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>= ; Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: [PATCH 1/4] EdkRepo: Installer should remove obsolete dependencies=

Cc: Ashley DeSimone <ashley.e.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 .../EdkRepoInstaller/InstallWorker.cs     &n= bsp;   | 30 +++++++++-
 edkrepo_installer/linux-scripts/install.py    | 58 = 3;+++++++++++-------
 2 files changed, 66 insertions(+), 22 deletions(-)

diff --git a/edkrepo_installer/EdkRepoInstaller/InstallWorker.cs b/edkrepo_= installer/EdkRepoInstaller/InstallWorker.cs
index 8d824f2..b44e8fa 100644
--- a/edkrepo_installer/EdkRepoInstaller/InstallWorker.cs
+++ b/edkrepo_installer/EdkRepoInstaller/InstallWorker.cs
@@ -710,6 +710,7 @@ namespace TianoCore.EdkRepoInstaller
            &nb= sp;    string PythonPath;
            &nb= sp;    bool Has32Bit;
            &nb= sp;    bool Has64Bit;
+           &nbs= p;    bool DeleteObsoletePackages =3D false;
            &nb= sp;    PythonOperations.GetPythonBitness(PyInstance.Version.= Major, PyInstance.Version.Minor, out Has32Bit, out Has64Bit);
            &nb= sp;    if (Has32Bit && Has64Bit && PyInstanc= e.Architecture =3D=3D CpuArchitecture.IA32)
            &nb= sp;    {
@@ -720,14 +721,39 @@ namespace TianoCore.EdkRepoInstaller
            &nb= sp;        PythonPath =3D PythonOperatio= ns.FindPython(PyInstance.Version.Major, PyInstance.Version.Minor, false);             &nb= sp;    }
            &nb= sp;    List<PythonPackage> InstalledPackages =3D Pytho= nOperations.GetInstalledPythonPackages(PythonPath);
-            &n= bsp;   foreach(PythonWheel Wheel in PyInstance.Wheels)
+           &nbs= p;    foreach (PythonWheel Wheel in PyInstance.Wheels)
+           &nbs= p;    {
+           &nbs= p;        //If a package is already inst= alled, check if we have a newer version bundled in the installer
+           &nbs= p;        //If yes, the package will be = upgraded, make sure obsolete packages are uninstalled first
+           &nbs= p;        PythonPackage InstalledPackage= =3D InstalledPackages.Where(p =3D> p.Name =3D=3D Wheel.Package.Name.Rep= lace('_', '-')).FirstOrDefault();
+           &nbs= p;        if (InstalledPackage !=3D null= && InstalledPackage.Version < Wheel.Package.Version)
+           &nbs= p;        {
+           &nbs= p;            Delete= ObsoletePackages =3D true;
+           &nbs= p;            break;=
+           &nbs= p;        }
+           &nbs= p;    }
+           &nbs= p;    if (DeleteObsoletePackages)
+           &nbs= p;    {
+           &nbs= p;        //
+           &nbs= p;        // Delete obsolete dependencie= s
+           &nbs= p;        //
+           &nbs= p;        foreach (string PackageName in= new string[] { "smmap2", "gitdb2" })
+           &nbs= p;        {
+           &nbs= p;            if (In= stalledPackages.Where(p =3D> p.Name =3D=3D PackageName).FirstOrDefault()= !=3D null)
+           &nbs= p;            {
+           &nbs= p;            &= nbsp;   InstallLogger.Log(string.Format("Uninstalling {0}&qu= ot;, PackageName));
+           &nbs= p;            &= nbsp;   PythonOperations.UninstallPythonPackage(PythonPath, Packa= geName);
+           &nbs= p;            }
+           &nbs= p;        }
+           &nbs= p;    }
+           &nbs= p;    foreach (PythonWheel Wheel in PyInstance.Wheels)
            &nb= sp;    {
            &nb= sp;        //PythonPackage InstalledPack= age =3D (from package in InstalledPackages
            &nb= sp;        //    &nb= sp;            =             &nb= sp;    where package.Name =3D=3D Wheel.Package.Name
            &nb= sp;        //    &nb= sp;            =             &nb= sp;    select package).FirstOrDefault();
            &nb= sp;        //If the package is already i= nstalled, check if we have a newer version bundled in the installer
            &nb= sp;        //If so, upgrade the package<= br> -            &n= bsp;       PythonPackage InstalledPackage =3D= InstalledPackages.Where(p =3D> p.Name =3D=3D Wheel.Package.Name).FirstO= rDefault();
+           &nbs= p;        PythonPackage InstalledPackage= =3D
+ InstalledPackages.Where(p =3D> p.Name =3D=3D Wheel.Package.Name.Re= place('_',
+ '-')).FirstOrDefault();
            &nb= sp;        if (InstalledPackage !=3D nul= l)
            &nb= sp;        {
            &nb= sp;            if (I= nstalledPackage.Version < Wheel.Package.Version) diff --git a/edkrepo_in= staller/linux-scripts/install.py b/edkrepo_installer/linux-scripts/install.= py
index 0ea486d..b2cdfed 100755
--- a/edkrepo_installer/linux-scripts/install.py
+++ b/edkrepo_installer/linux-scripts/install.py
@@ -3,7 +3,7 @@
 ## @file
 # install.py
 #
-# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR= >
+# Copyright (c) 2018 - 2020, Intel Corporation. All rights
+reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent  #
 
@@ -53,6 +53,26 @@ def get_args():
     parser.add_argument('-v', '--verbose', action=3D's= tore_true', default=3DFalse, help=3D'Enables verbose output')
     return parser.parse_args()
 
+def get_installed_packages(python_command):
+    pip_cmd =3D [def_python, '-m', 'pip', 'list', '--le= gacy']
+    try:
+        res =3D default_run(pip_cmd= )
+    except:
+        pip_cmd.pop(-1)
+        try:
+            res= =3D default_run(pip_cmd)
+        except:
+            ret= urn ret_val
+    installed_packages =3D {}
+    for pip_mod in res.stdout.split('\n'):
+        try:
+            nam= e, version =3D pip_mod.split()
+            ver= sion =3D version.strip().strip('()')
+        except:
+            con= tinue
+        installed_packages[name] = =3D version
+    return installed_packages
+
 def get_required_wheels():
     ret_val =3D collections.OrderedDict()
     if platform.machine() =3D=3D 'x86_64':
@@ -79,27 +99,11 @@ def get_required_wheels():
            &nb= sp;            =             &nb= sp;            'vers= ion':wheel.attrib['Version'],
            &nb= sp;            =             &nb= sp;            'inst= all':True}
             br= eak
-    pip_cmd =3D [def_python, '-m', 'pip', 'list', '--legacy= ']
-    try:
-        res =3D default_run(pip_cmd) -    except:
-        pip_cmd.pop(-1)
-        try:
-            res =3D= default_run(pip_cmd)
-        except:
-            return = ret_val
-    installed_modules =3D {}
-    for pip_mod in res.stdout.split('\n'):
-        try:
-            name, v= ersion =3D pip_mod.split()
-            version= =3D version.strip().strip('()')
-        except:
-            continu= e
-        installed_modules[name] =3D ver= sion
+    installed_packages =3D get_installed_packages(def_p= ython)
     for name in ret_val:
         #pip doesn't understand th= e difference between '_' and '-'
-        if name.replace('_','-') in ins= talled_modules:
-            version= =3D installed_modules[name.replace('_','-')]
+        if name.replace('_','-') in= installed_packages:
+            ver= sion =3D installed_packages[name.replace('_','-')]
             if= _check_version(version, ret_val[name]['version']) >=3D 0 and not ret_va= l[name]['uninstall']:
            &nb= sp;    ret_val[name]['install'] =3D False
             el= se:
@@ -328,16 +332,30 @@ def do_install():
         if not os.path.isdir(whl_s= rc_dir):
             lo= g.info('- Missing wheel file directory')
             re= turn 1
+        updating_edkrepo =3D False<= br>          for whl_name in wheels_to_= install:
             un= install_whl =3D wheels_to_install[whl_name]['uninstall']
             wh= l_name =3D whl_name.replace('_','-')  #pip doesn't understand the diff= erence between '_' and '-'
             if= uninstall_whl:
+           &nbs= p;    updating_edkrepo =3D True
            &nb= sp;    try:
            &nb= sp;        res =3D default_run([def_pyth= on, '-m', 'pip', 'uninstall', '--yes', whl_name])
            &nb= sp;    except:
            &nb= sp;        log.info('- Failed to uninsta= ll {}'.format(whl_name))
            &nb= sp;        return 1
            &nb= sp;    log.info('+ Uninstalled {}'.format(whl_name))
+
+        #Delete obsolete dependenci= es
+        if updating_edkrepo:
+            ins= talled_packages =3D get_installed_packages(def_python)
+            for= whl_name in ['smmap2', 'gitdb2']:
+           &nbs= p;    if whl_name in installed_packages:
+           &nbs= p;        try:
+           &nbs= p;            res = =3D default_run([def_python, '-m', 'pip', 'uninstall', '--yes', whl_name])<= br> +           &nbs= p;        except:
+           &nbs= p;            log.in= fo('- Failed to uninstall {}'.format(whl_name))
+           &nbs= p;            return= 1
+           &nbs= p;        log.info('+ Uninstalled {}= '.format(whl_name))
         for whl_name in wheels_to_= install:
             wh= l =3D wheels_to_install[whl_name]['wheel']
             in= stall_whl =3D wheels_to_install[whl_name]['install']
--
2.24.0.windows.2

 

--_000_CY4PR21MB074359B437B9A38717AE4FF1EFF40CY4PR21MB0743namp_--