コード例 #1
0
def remove_package(args):
    """Remove installed package."""
    installed_packages = package.get_installed_packages()
    package_name = args.name
    for installed_package in installed_packages:
        name = package.argospm_package_name(installed_package)
        if name == package_name:
            package.uninstall(installed_package)
            print(f"Removed package {name}")
            break
    else:
        print("Package not found")
        exit(1)
コード例 #2
0
ファイル: gui.py プロジェクト: gdh756462786/argos-translate
 def uninstall_package(self, pkg):
     try:
         package.uninstall(pkg)
     except OSError as e:
         # packages included in a snap archive are on a
         # read-only filesystem and can't be deleted
         if 'SNAP' in os.environ:
             about_message_box = QMessageBox()
             about_message_box.setWindowTitle('Error')
             about_message_box.setText('Error deleting package: \n' + 
                 'Packages pre-installed in a snap archive can\'t be deleted')
             about_message_box.setIcon(QMessageBox.Warning)
             about_message_box.exec_()
         else:
             raise e
     self.populate_packages_table()
     self.packages_changed.emit()
コード例 #3
0
ファイル: gui.py プロジェクト: niedev/argos-translate
 def uninstall_package(self, pkg):
     try:
         package.uninstall(pkg)
     except OSError as e:
         # packages included in a snap archive are on a
         # read-only filesystem and can't be deleted
         if "SNAP" in os.environ:
             error_message_box = QMessageBox()
             error_message_box.setWindowTitle("Error")
             error_message_box.setText(
                 "Error deleting package: \n"
                 + "Packages pre-installed in a snap archive can't be deleted"
             )
             error_message_box.setIcon(QMessageBox.Warning)
             error_message_box.exec_()
         else:
             raise e
     self.packages_changed.emit()
     self.populate()
     self.packages_changed.emit()