public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging/EdkRepo] [PATCH] EdkRepo: Support uninstalling packages with '_' in their name.
@ 2019-12-10  9:56 Nate DeSimone
  2019-12-12  0:23 ` Desimone, Ashley E
  0 siblings, 1 reply; 2+ messages in thread
From: Nate DeSimone @ 2019-12-10  9:56 UTC (permalink / raw)
  To: devel; +Cc: Ashley DeSimone, Puja Pandya, Bret Barkelew

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.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Support uninstalling packages with '_' in their name.
  2019-12-10  9:56 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Support uninstalling packages with '_' in their name Nate DeSimone
@ 2019-12-12  0:23 ` Desimone, Ashley E
  0 siblings, 0 replies; 2+ messages in thread
From: Desimone, Ashley E @ 2019-12-12  0:23 UTC (permalink / raw)
  To: Desimone, Nathaniel L, devel@edk2.groups.io; +Cc: Pandya, Puja, Bret Barkelew

Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com>

-----Original Message-----
From: Desimone, Nathaniel L 
Sent: Tuesday, December 10, 2019 1:56 AM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E <ashley.e.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Support uninstalling packages with '_' in their name.

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.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-12  0:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-10  9:56 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Support uninstalling packages with '_' in their name Nate DeSimone
2019-12-12  0:23 ` Desimone, Ashley E

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox