mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-05 11:02:14 +01:00
Replace sys.exit() module with SystemExit()
This commit is contained in:
parent
22b54888d9
commit
dcc431b608
29 changed files with 49 additions and 76 deletions
|
@ -64,7 +64,7 @@ class Auto(object):
|
|||
sys.stdout.flush()
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
self.execute()
|
||||
|
||||
def execute(self):
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from slpkg.messages import Msg
|
||||
|
@ -65,7 +64,7 @@ def pkg_upgrade(repo, skip):
|
|||
return pkgs_for_upgrade
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
|
||||
def installed():
|
||||
|
|
|
@ -60,6 +60,6 @@ class Dependencies(object):
|
|||
return self.dep_results
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
else:
|
||||
return []
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from slpkg.utils import Utils
|
||||
from slpkg.sizes import units
|
||||
|
@ -133,7 +132,7 @@ class BinaryInstall(object):
|
|||
Msg().not_found(self.if_upgrade)
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def update_deps(self):
|
||||
"""Update dependencies dictionary with all package
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
from slpkg.utils import Utils
|
||||
from slpkg.toolbar import status
|
||||
from slpkg.blacklist import BlackList
|
||||
|
@ -49,4 +47,4 @@ def search_pkg(name, repo):
|
|||
return pkg_name
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
from messages import Msg
|
||||
from arguments import usage
|
||||
from init import Initialization
|
||||
|
@ -76,12 +74,12 @@ class Updates(object):
|
|||
self.check = self.all_repos[self.repo]()
|
||||
except OSError:
|
||||
usage(self.repo)
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
elif self.repo in self.meta.repositories:
|
||||
self.check = self._init.custom(self.repo)
|
||||
else:
|
||||
usage(self.repo)
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
self.status_bar()
|
||||
self.status()
|
||||
self.print_status(self.repo)
|
||||
|
@ -97,7 +95,7 @@ class Updates(object):
|
|||
self.check = self.all_repos[repo]()
|
||||
except OSError:
|
||||
usage(self.repo)
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
elif repo in self.meta.repositories:
|
||||
self.check = self._init.custom(repo)
|
||||
self.status()
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
from md5sum import md5
|
||||
from messages import Msg
|
||||
from __metadata__ import MetaData as _meta_
|
||||
|
@ -47,7 +45,7 @@ def check_md5(pkg_md5, src_file):
|
|||
Msg().template(78)
|
||||
print("")
|
||||
if not Msg().answer() in ["y", "Y"]:
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
else:
|
||||
Msg().template(78)
|
||||
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from utils import Utils
|
||||
|
@ -73,7 +72,7 @@ class Config(object):
|
|||
self.meta.color["ENDC"]))
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
print("") # new line at end
|
||||
|
||||
def edit(self, editor):
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from messages import Msg
|
||||
|
@ -68,7 +67,7 @@ class Download(object):
|
|||
dwn_count += 1
|
||||
except KeyboardInterrupt:
|
||||
print # new line at cancel
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def _directory_prefix(self):
|
||||
"""Downloader options for specific directory
|
||||
|
@ -90,7 +89,7 @@ class Download(object):
|
|||
Msg().template(78)
|
||||
print("")
|
||||
if not Msg().answer() in ["y", "Y"]:
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def _check_certificate(self):
|
||||
"""Check for certificates options for wget
|
||||
|
@ -106,4 +105,4 @@ class Download(object):
|
|||
print("")
|
||||
self.downder_options += certificate
|
||||
if not Msg().answer() in ["y", "Y"]:
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
|
||||
|
@ -44,7 +43,7 @@ class FileSize(object):
|
|||
return " "
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at cancel
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def local(self):
|
||||
"""
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from messages import Msg
|
||||
from __metadata__ import MetaData as _meta_
|
||||
|
@ -63,7 +62,7 @@ class PackageHealth(object):
|
|||
print(line)
|
||||
except (KeyboardInterrupt, IOError):
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def test(self):
|
||||
"""Get started test each package and read file list
|
||||
|
@ -81,7 +80,7 @@ class PackageHealth(object):
|
|||
self.check(line, pkg)
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
self.results()
|
||||
|
||||
def results(self):
|
||||
|
|
|
@ -659,7 +659,7 @@ class Initialization(object):
|
|||
shutil.rmtree(files)
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
Update().repository(only)
|
||||
|
||||
|
||||
|
@ -700,9 +700,9 @@ class Update(object):
|
|||
sys.stdout.write(self.error)
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
print("") # new line at end
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
|
||||
def check_exists_repositories():
|
||||
|
@ -721,4 +721,4 @@ def check_exists_repositories():
|
|||
print("\n Please update packages lists. Run 'slpkg update'.\n" +
|
||||
" This command should be used to synchronize packages\n" +
|
||||
" lists from the repositories are enabled.\n")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -555,7 +555,7 @@ class ArgParse(object):
|
|||
if not_found:
|
||||
for ntf in not_found:
|
||||
Msg().pkg_not_found("", ntf, "Not installed", "")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -568,7 +568,7 @@ def main():
|
|||
|
||||
if len(args) == 0:
|
||||
usage("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
argparse.auto_detect(args)
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class Msg(object):
|
|||
"""
|
||||
if user != "root":
|
||||
print("\nslpkg: error: must have root privileges\n")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def build_FAILED(self, sbo_url, prgnam):
|
||||
"""Print error message if build failed
|
||||
|
@ -136,7 +136,7 @@ class Msg(object):
|
|||
answer = raw_input("Would you like to continue [y/N]? ")
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
return answer
|
||||
|
||||
def reference(self, install, upgrade):
|
||||
|
|
|
@ -104,7 +104,7 @@ class BuildPackage(object):
|
|||
Msg().pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def _makeflags(self):
|
||||
"""Set variable MAKEFLAGS with the numbers of
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from slpkg.utils import Utils
|
||||
|
@ -99,7 +98,7 @@ class PackageManager(object):
|
|||
str(len(self.removed)), msg))
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
if remove_pkg in ["y", "Y"]:
|
||||
self._check_if_used(self.binary)
|
||||
for rmv in self.removed:
|
||||
|
@ -131,7 +130,7 @@ class PackageManager(object):
|
|||
print("")
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
return remove_dep
|
||||
|
||||
def _view_removed(self):
|
||||
|
@ -176,7 +175,7 @@ class PackageManager(object):
|
|||
os.remove(self.dep_path + package) # remove log
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def _rmv_deps(self, dependencies, package):
|
||||
"""Remove dependencies
|
||||
|
@ -210,7 +209,7 @@ class PackageManager(object):
|
|||
self.skip = raw_input(" > ").split()
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
for s in self.skip:
|
||||
if s in self.removed:
|
||||
self.removed.remove(s)
|
||||
|
@ -348,7 +347,7 @@ class PackageManager(object):
|
|||
print("") # new line at end
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def list_greps(self, repo, packages):
|
||||
"""Grep packages
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
from messages import Msg
|
||||
from sbo.greps import SBoGrep
|
||||
from pkg.manager import PackageManager
|
||||
|
@ -63,7 +61,7 @@ def find_from_repos(pkg):
|
|||
_meta_.color["GREY"], count_pkg, count_repo, _meta_.color["ENDC"]))
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
|
||||
def sbo_version(repo, find):
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from sizes import units
|
||||
from utils import Utils
|
||||
|
@ -101,7 +100,7 @@ class RepoInfo(object):
|
|||
for key, value in sorted(self.form.iteritems()):
|
||||
print self.meta.color["GREY"] + key + self.meta.color["ENDC"], value
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def repository_data(self, repo):
|
||||
"""
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
from messages import Msg
|
||||
from repositories import Repo
|
||||
from __metadata__ import MetaData as _meta_
|
||||
|
@ -92,4 +90,4 @@ class RepoList(object):
|
|||
print("For enable or disable default repositories edit "
|
||||
"'/etc/slpkg/slpkg.conf' file.\n{0}".format(
|
||||
self.meta.color["ENDC"]))
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from utils import Utils
|
||||
from __metadata__ import MetaData as _meta_
|
||||
|
@ -52,17 +51,17 @@ class Repo(object):
|
|||
print("\nRepository name '{0}' exist, select different name.\n"
|
||||
"View all repositories with command 'repo-list'.\n".format(
|
||||
repo))
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
elif len(repo) > 6:
|
||||
print("\nMaximum repository name length must be six (6) "
|
||||
"characters\n")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
with open(self.repo_file, "a") as repos:
|
||||
new_line = " {0}{1}{2}\n".format(repo, " " * (10 - len(repo)), url)
|
||||
repos.write(new_line)
|
||||
repos.close()
|
||||
print("\nRepository '{0}' successfully added\n".format(repo))
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def remove(self, repo):
|
||||
"""
|
||||
|
@ -81,7 +80,7 @@ class Repo(object):
|
|||
repos.close()
|
||||
if not rem_repo:
|
||||
print("\nRepository '{0}' doesn't exist\n".format(repo))
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def custom_repository(self):
|
||||
"""
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from slpkg.messages import Msg
|
||||
|
@ -57,7 +56,7 @@ def sbo_upgrade(skip):
|
|||
return upgrade_names
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
|
||||
def sbo_list():
|
||||
|
|
|
@ -65,6 +65,6 @@ class Requires(object):
|
|||
return self.dep_results
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
else:
|
||||
return []
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
from slpkg.utils import Utils
|
||||
from slpkg.repositories import Repo
|
||||
from slpkg.__metadata__ import MetaData as _meta_
|
||||
|
@ -48,4 +46,4 @@ def sbo_search_pkg(name):
|
|||
return ""
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from slpkg.utils import Utils
|
||||
from slpkg.messages import Msg
|
||||
|
@ -131,7 +130,7 @@ class SBoInstall(object):
|
|||
Msg().not_found(if_upgrade)
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def update_deps(self):
|
||||
"""Update dependencies dictionary with all package
|
||||
|
@ -315,7 +314,7 @@ class SBoInstall(object):
|
|||
binary = (self.meta.output + max(binary_list)).split()
|
||||
except ValueError:
|
||||
Msg().build_FAILED(sbo_url, prgnam)
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
find = GetFromInstalled(pkg).name()
|
||||
if find == pkg:
|
||||
print("[ {0}Upgrading{1} ] --> {2}".format(
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
|
@ -128,7 +127,7 @@ class Patches(object):
|
|||
"date\n".format(slack_arch, self.version, slack_ver()))
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def store(self):
|
||||
"""
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tarfile
|
||||
import subprocess
|
||||
|
||||
|
@ -62,7 +61,7 @@ def it_self_update():
|
|||
if answer in ["y", "Y"]:
|
||||
print("") # new line after answer
|
||||
else:
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
dwn_link = ["https://{0}.com/{1}/{2}/archive/"
|
||||
"v{3}.tar.gz".format(repository, _meta_.__author__,
|
||||
_meta_.__all__,
|
||||
|
@ -85,4 +84,4 @@ def it_self_update():
|
|||
else:
|
||||
print("\n{0}: There is no new version, already used the last !"
|
||||
"\n".format(_meta_.__all__))
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -41,4 +41,4 @@ def status(sec):
|
|||
time.sleep(float(sec))
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
from __metadata__ import MetaData as _meta_
|
||||
|
@ -48,4 +47,4 @@ class URL(object):
|
|||
return " "
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from splitting import split_package
|
||||
|
||||
|
@ -70,7 +69,7 @@ class Utils(object):
|
|||
return packages
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
||||
def check_downloaded(self, path, maybe_downloaded):
|
||||
"""
|
||||
|
@ -95,4 +94,4 @@ class Utils(object):
|
|||
return line
|
||||
except KeyboardInterrupt:
|
||||
print("")
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
|
|
Loading…
Reference in a new issue