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 <ashley.e.desim...@intel.com>
Cc: Puja Pandya <puja.pan...@intel.com>
Cc: Bret Barkelew <bret.barke...@microsoft.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desim...@intel.com>
---
 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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52080): https://edk2.groups.io/g/devel/message/52080
Mute This Topic: https://groups.io/mt/67968737/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to