Skip to content

Commit

Permalink
fix: conform to pyinstaller by using sys's exit()
Browse files Browse the repository at this point in the history
  • Loading branch information
kernel-dev committed May 14, 2022
1 parent 4436dd5 commit b3ba13e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3

if __name__ == "__main__":
import sys
from sys import exit, version_info, version
from src.util.missing_dep import Requirements, REQUIRED
if sys.version_info < (3, 8, 0):
if version_info < (3, 8, 0):
print("OCSysInfo requires Python 3.8, while Python " + str(
sys.version.partition(" ")[0]) + " was detected. Terminating... ")
sys.exit(1)
version.partition(" ")[0]) + " was detected. Terminating... ")
exit(1)

# Check if there are missing dependencies
requirements = Requirements()
Expand Down Expand Up @@ -58,7 +58,7 @@
"Try running this program using elevated privileges.", "red"))
logger.critical("Could not access the required data. Exiting OCSysInfo\n\t"
f"^^^^^^^^{str(e)}", __file__)
sys.exit(0)
exit(0)
else:
raise e
finally:
Expand All @@ -68,4 +68,4 @@
logger.info("Successfully launched OCSysInfo.", __file__)
except KeyboardInterrupt:
logger.info("Exited successfully.", __file__)
sys.exit(0)
exit(0)
1 change: 1 addition & 0 deletions src/cli/flags.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
from sys import exit
from src.cli.ui import clear
from src.info import color_text
from src.util.dump_functions.text import dump_txt
Expand Down
1 change: 1 addition & 0 deletions src/cli/ui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import subprocess
import sys
from sys import exit
from src.info import name, version, arch, color_text, format_text, surprise
from src.info import root_dir as root
from src.util.os_version import os_ver
Expand Down
1 change: 1 addition & 0 deletions src/dumps/Linux/linux.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import re
import subprocess
from sys import exit
from src.error.cpu_err import cpu_err
from src.util.codename import gpu
from src.util.pci_root import pci_from_acpi_linux
Expand Down
2 changes: 2 additions & 0 deletions src/error/cpu_err.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from sys import exit

def cpu_err(e):
print("Something went wrong during 'CPU' discovery.")
print(
Expand Down
2 changes: 1 addition & 1 deletion src/util/missing_dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from unittest import TestCase
from pkg_resources import require, DistributionNotFound
from subprocess import call
from sys import platform, executable
from sys import platform, executable, exit
from src import info

try:
Expand Down

0 comments on commit b3ba13e

Please sign in to comment.