From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.7869.1575971790156425445 for ; Tue, 10 Dec 2019 01:56:30 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: nathaniel.l.desimone@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2019 01:56:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,299,1571727600"; d="scan'208";a="238057522" Received: from klmarek-mobl.amr.corp.intel.com ([10.252.198.171]) by fmsmga004.fm.intel.com with ESMTP; 10 Dec 2019 01:56:29 -0800 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Ashley DeSimone , Puja Pandya , Bret Barkelew Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Support uninstalling packages with '_' in their name. Date: Tue, 10 Dec 2019 01:56:22 -0800 Message-Id: <20191210095622.89893-1-nathaniel.l.desimone@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit pip does not support '_' in package names and converts them to '-' after installing the wheel. In order to uninstall affected packages the '_' needs to be converted to a '-' when calculating the package name. Cc: Ashley DeSimone Cc: Puja Pandya Cc: Bret Barkelew Signed-off-by: Nate DeSimone --- edkrepo_installer/linux-scripts/install.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/edkrepo_installer/linux-scripts/install.py b/edkrepo_installer/linux-scripts/install.py index a05ce6a..66421ba 100755 --- a/edkrepo_installer/linux-scripts/install.py +++ b/edkrepo_installer/linux-scripts/install.py @@ -93,8 +93,9 @@ def get_required_wheels(): continue installed_modules[name] = version for name in ret_val: - if name in installed_modules: - version = installed_modules[name] + #pip doesn't understand the difference between '_' and '-' + if name.replace('_','-') in installed_modules: + version = installed_modules[name.replace('_','-')] if _check_version(version, ret_val[name]['version']) >= 0 and not ret_val[name]['uninstall']: ret_val[name]['install'] = False else: @@ -294,9 +295,8 @@ def do_install(): log.info('- Missing wheel file directory') return 1 for whl_name in wheels_to_install: - whl = wheels_to_install[whl_name]['wheel'] - install_whl = wheels_to_install[whl_name]['install'] uninstall_whl = wheels_to_install[whl_name]['uninstall'] + whl_name = whl_name.replace('_','-') #pip doesn't understand the difference between '_' and '-' if uninstall_whl: try: res = default_run(['python3', '-m', 'pip', 'uninstall', '--yes', whl_name]) @@ -304,6 +304,9 @@ def do_install(): log.info('- Failed to uninstall {}'.format(whl_name)) return 1 log.info('+ Uninstalled {}'.format(whl_name)) + for whl_name in wheels_to_install: + whl = wheels_to_install[whl_name]['wheel'] + install_whl = wheels_to_install[whl_name]['install'] if install_whl: install_cmd = ['python3', '-m', 'pip', 'install'] if args.local: -- 2.20.1