From 30f8afc2f8895a907b96070f20b93874fd3f5870 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Fri, 8 Sep 2023 12:57:23 -0700 Subject: [PATCH] replace exit() with sys.exit() --- kcc-c2e.py | 2 +- kcc-c2p.py | 2 +- kcc.py | 2 +- kindlecomicconverter/comic2ebook.py | 4 ++-- kindlecomicconverter/shared.py | 3 ++- setup.py | 8 ++++---- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/kcc-c2e.py b/kcc-c2e.py index bb38740b..ed24575b 100755 --- a/kcc-c2e.py +++ b/kcc-c2e.py @@ -22,7 +22,7 @@ if sys.version_info < (3, 8, 0): print('ERROR: This is a Python 3.8+ script!') - exit(1) + sys.exit(1) from multiprocessing import freeze_support, set_start_method from kindlecomicconverter.startup import startC2E diff --git a/kcc-c2p.py b/kcc-c2p.py index 353776d5..be8a9819 100755 --- a/kcc-c2p.py +++ b/kcc-c2p.py @@ -22,7 +22,7 @@ if sys.version_info < (3, 8, 0): print('ERROR: This is a Python 3.8+ script!') - exit(1) + sys.exit(1) from multiprocessing import freeze_support, set_start_method from kindlecomicconverter.startup import startC2P diff --git a/kcc.py b/kcc.py index b8c5a0f8..737b4d39 100755 --- a/kcc.py +++ b/kcc.py @@ -22,7 +22,7 @@ if sys.version_info < (3, 8, 0): print('ERROR: This is a Python 3.8+ script!') - exit(1) + sys.exit(1) # OS specific workarounds import os diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index dc774f80..0b69ec5e 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -1105,13 +1105,13 @@ def checkTools(source): process.communicate() if process.returncode != 0 and process.returncode != 7: print('ERROR: 7z is missing!') - exit(1) + sys.exit(1) if options.format == 'MOBI': kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True) kindleGenExitCode.communicate() if kindleGenExitCode.returncode != 0: print('ERROR: KindleGen is missing!') - exit(1) + sys.exit(1) def checkPre(source): diff --git a/kindlecomicconverter/shared.py b/kindlecomicconverter/shared.py index 5c1136b0..2c1a3a9c 100644 --- a/kindlecomicconverter/shared.py +++ b/kindlecomicconverter/shared.py @@ -23,6 +23,7 @@ from html.parser import HTMLParser from distutils.version import StrictVersion from re import split +import sys from traceback import format_tb @@ -133,4 +134,4 @@ def dependencyCheck(level): missing.append('Pillow 5.2.0+') if len(missing) > 0: print('ERROR: ' + ', '.join(missing) + ' is not installed!') - exit(1) + sys.exit(1) diff --git a/setup.py b/setup.py index 5d26fa8b..0c28b485 100644 --- a/setup.py +++ b/setup.py @@ -40,16 +40,16 @@ def run(self): os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s kcc.py') # TODO /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime dist/Applications/Kindle\ Comic\ Converter.app -v os.system('appdmg kcc.json dist/KindleComicConverter_osx_' + VERSION + '.dmg') - exit(0) + sys.exit(0) elif sys.platform == 'win32': os.system('pyinstaller -y -F -i icons\\comic2ebook.ico -n KCC_' + VERSION + ' -w --noupx kcc.py') - exit(0) + sys.exit(0) elif sys.platform == 'linux': os.system( 'pyinstaller --hidden-import=queue -y -F -i icons/comic2ebook.ico -n kcc_linux_' + VERSION + ' kcc.py') - exit(0) + sys.exit(0) else: - exit(0) + sys.exit(0) setuptools.setup(