mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-29 10:26:12 +01:00
Added KeyboardInterrupt
This commit is contained in:
parent
5a37c1c85b
commit
e73a4bd31f
1 changed files with 14 additions and 6 deletions
|
@ -53,7 +53,7 @@ class PackageManager(object):
|
||||||
subprocess.call("installpkg {0} {1}".format(flag, pkg),
|
subprocess.call("installpkg {0} {1}".format(flag, pkg),
|
||||||
shell=True)
|
shell=True)
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
except subprocess.CalledProcessError:
|
except (subprocess.CalledProcessError, KeyboardInterrupt):
|
||||||
self._not_found("Can't install", self.binary, pkg)
|
self._not_found("Can't install", self.binary, pkg)
|
||||||
|
|
||||||
def upgrade(self, flag):
|
def upgrade(self, flag):
|
||||||
|
@ -65,7 +65,7 @@ class PackageManager(object):
|
||||||
subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
|
subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
|
||||||
shell=True)
|
shell=True)
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
except subprocess.CalledProcessError:
|
except (subprocess.CalledProcessError, KeyboardInterrupt):
|
||||||
self._not_found("Can't upgrade", self.binary, pkg)
|
self._not_found("Can't upgrade", self.binary, pkg)
|
||||||
|
|
||||||
def _not_found(self, message, binary, pkg):
|
def _not_found(self, message, binary, pkg):
|
||||||
|
@ -188,8 +188,12 @@ class PackageManager(object):
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
if (dep not in skip
|
if (dep not in skip
|
||||||
and find_package(dep + self.meta.sp, self.meta.pkg_path)):
|
and find_package(dep + self.meta.sp, self.meta.pkg_path)):
|
||||||
subprocess.call("removepkg {0} {1}".format(self.flag, dep),
|
try:
|
||||||
shell=True)
|
subprocess.call("removepkg {0} {1}".format(self.flag, dep),
|
||||||
|
shell=True)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("")
|
||||||
|
sys.exit(0)
|
||||||
removes.append(dep)
|
removes.append(dep)
|
||||||
os.remove(path + package)
|
os.remove(path + package)
|
||||||
return removes
|
return removes
|
||||||
|
@ -199,8 +203,12 @@ class PackageManager(object):
|
||||||
Remove one signle package
|
Remove one signle package
|
||||||
"""
|
"""
|
||||||
if find_package(package + self.meta.sp, self.meta.pkg_path):
|
if find_package(package + self.meta.sp, self.meta.pkg_path):
|
||||||
subprocess.call("removepkg {0} {1}".format(self.flag, package),
|
try:
|
||||||
shell=True)
|
subprocess.call("removepkg {0} {1}".format(self.flag, package),
|
||||||
|
shell=True)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("")
|
||||||
|
sys.exit(0)
|
||||||
return package.split()
|
return package.split()
|
||||||
|
|
||||||
def _reference_rmvs(self, removes):
|
def _reference_rmvs(self, removes):
|
||||||
|
|
Loading…
Reference in a new issue