(self, package_name)
return True
Deletes a package

        The deletion process consists of:

        1. Deleting the directory (or marking it for deletion if deletion fails)
        2. Submitting usage info
        3. Removing the package from the list of installed packages

        :param package_name:
            The package to delete

        :return: bool if the package was successfully deleted
Deletes a package
Deletes a package
def remove_package(self, package_name):
        """
        Deletes a package

        The deletion process consists of:

        1. Deleting the directory (or marking it for deletion if deletion fails)
        2. Submitting usage info
        3. Removing the package from the list of installed packages

        :param package_name:
            The package to delete

        :return: bool if the package was successfully deleted
        """

        installed_packages = self.list_packages()

        if package_name not in installed_packages:
            show_error(u'The package specified, %s, is not installed' % package_name)
            return False

        os.chdir(sublime.packages_path())

        # Give Sublime Text some time to ignore the package
        time.sleep(1)

        package_filename = package_name + '.sublime-package'
        installed_package_path = os.path.join(sublime.installed_packages_path(),
            package_filename)
        pristine_package_path = os.path.join(os.path.dirname(
            sublime.packages_path()), 'Pristine Packages', package_filename)
        package_dir = self.get_package_dir(package_name)

        version = self.get_metadata(package_name).get('version')

        try:
            if os.path.exists(installed_package_path):
                os.remove(installed_package_path)
        except (OSError, IOError) as e:
            show_error(u'An error occurred while trying to remove the installed package file for %s.\n\n%s' % (
                package_name, unicode_from_os(e)))
            return False

        try:
            if os.path.exists(pristine_package_path):
                os.remove(pristine_package_path)
        except (OSError, IOError) as e:
            show_error(u'An error occurred while trying to remove the pristine package file for %s.\n\n%s' % (
                package_name, unicode_from_os(e)))
            return False

        # We don't delete the actual package dir immediately due to a bug
        # in sublime_plugin.py
        can_delete_dir = True
        if not clear_directory(package_dir):
            # If there is an error deleting now, we will mark it for
            # cleanup the next time Sublime Text starts
            open_compat(os.path.join(package_dir, 'package-control.cleanup'),
                'w').close()
            can_delete_dir = False

        params = {
            'package': package_name,
            'operation': 'remove',
            'version': version
        }
        self.record_usage(params)

        # Remove the package from the installed packages list
        def clear_package():
            settings = sublime.load_settings('Package Control.sublime-settings')
            installed_packages = settings.get('installed_packages', [])
            if not installed_packages:
                installed_packages = []
            installed_packages.remove(package_name)
            settings.set('installed_packages', installed_packages)
            sublime.save_settings('Package Control.sublime-settings')
        sublime.set_timeout(clear_package, 1)

        if can_delete_dir and os.path.exists(package_dir):
            os.rmdir(package_dir)

        return True
def remove_package ( self , package_name ) : installed_packages = self . list_packages ( ) if package_name not in installed_packages : show_error ( u'The package specified, %s, is not installed' % package_name ) return False os . chdir ( sublime . packages_path ( ) ) # Give Sublime Text some time to ignore the package time . sleep ( 1 ) package_filename = package_name + '.sublime-package' installed_package_path = os . path . join ( sublime . installed_packages_path ( ) , package_filename ) pristine_package_path = os . path . join ( os . path . dirname ( sublime . packages_path ( ) ) , 'Pristine Packages' , package_filename ) package_dir = self . get_package_dir ( package_name ) version = self . get_metadata ( package_name ) . get ( 'version' ) try : if os . path . exists ( installed_package_path ) : os . remove ( installed_package_path ) except ( OSError , IOError ) as e : show_error ( u'An error occurred while trying to remove the installed package file for %s.\n\n%s' % ( package_name , unicode_from_os ( e ) ) ) return False try : if os . path . exists ( pristine_package_path ) : os . remove ( pristine_package_path ) except ( OSError , IOError ) as e : show_error ( u'An error occurred while trying to remove the pristine package file for %s.\n\n%s' % ( package_name , unicode_from_os ( e ) ) ) return False # We don't delete the actual package dir immediately due to a bug # in sublime_plugin.py can_delete_dir = True if not clear_directory ( package_dir ) : # If there is an error deleting now, we will mark it for # cleanup the next time Sublime Text starts open_compat ( os . path . join ( package_dir , 'package-control.cleanup' ) , 'w' ) . close ( ) can_delete_dir = False params = { 'package' : package_name , 'operation' : 'remove' , 'version' : version } self . record_usage ( params ) # Remove the package from the installed packages list def clear_package ( ) : settings = sublime . load_settings ( 'Package Control.sublime-settings' ) installed_packages = settings . get ( 'installed_packages' , [ ] ) if not installed_packages : installed_packages = [ ] installed_packages . remove ( package_name ) settings . set ( 'installed_packages' , installed_packages ) sublime . save_settings ( 'Package Control.sublime-settings' ) sublime . set_timeout ( clear_package , 1 ) if can_delete_dir and os . path . exists ( package_dir ) : os . rmdir ( package_dir ) return True