Changeset 11025:b69249383d87 in orange for Orange/utils/addons.py


Ignore:
Timestamp:
11/14/12 13:29:40 (17 months ago)
Author:
Matija Polajnar <matija.polajnar@…>
Branch:
default
Message:

Add-ons: enable uninstallation on systems with pip installed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/utils/addons.py

    r11024 r11025  
    247247        func() 
    248248 
    249 def uninstall(name, progress_callback=None): #TODO 
    250     raise Exception('Unable to uninstall %s: uninstallation of add-ons is not yet implemented.' % name) 
    251     # Implement this either by using pip.commands.uninstall, and complain if pip is not installed on the system, 
    252     # or by "stealing" pip's uninstallation code. 
     249def uninstall(name, progress_callback=None): 
     250    try: 
     251        import pip.req 
     252        ao = pip.req.InstallRequirement(name, None) 
     253        ao.uninstall(True) 
     254    except ImportError: 
     255        raise Exception("Pip is required for add-on uninstallation. Install pip and try again.") 
    253256 
    254257def upgrade(name, progress_callback=None): 
Note: See TracChangeset for help on using the changeset viewer.