1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-07-07 09:50:07 +02:00

pylint: Reenable R1722 consider-using-sys-exit

* R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
This commit is contained in:
FestplattenSchnitzel 2023-03-05 14:38:42 +01:00 committed by Hans-Christoph Steiner
parent 1fbfae355a
commit a4c1ca48ad
4 changed files with 10 additions and 9 deletions

View File

@ -91,7 +91,7 @@ with open('buildserver/Vagrantfile') as fp:
m = re.search(r"""\.vm\.box\s*=\s*["'](.*)["']""", fp.read()) m = re.search(r"""\.vm\.box\s*=\s*["'](.*)["']""", fp.read())
if not m: if not m:
logging.error('Cannot find box name in buildserver/Vagrantfile!') logging.error('Cannot find box name in buildserver/Vagrantfile!')
exit(1) sys.exit(1)
config['basebox'] = m.group(1) config['basebox'] = m.group(1)
config['basebox_version'] = BASEBOX_VERSION_DEFAULT config['basebox_version'] = BASEBOX_VERSION_DEFAULT
config['cachedir'] = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver') config['cachedir'] = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver')
@ -107,7 +107,7 @@ elif os.path.exists('makebs.config.py'):
if show_config_deprecation: if show_config_deprecation:
logging.error('Config is via %s and command line flags.' % configfile) logging.error('Config is via %s and command line flags.' % configfile)
parser.print_help() parser.print_help()
exit(1) sys.exit(1)
logging.debug("Vagrantfile.yaml parsed -> %s", json.dumps(config, indent=4, sort_keys=True)) logging.debug("Vagrantfile.yaml parsed -> %s", json.dumps(config, indent=4, sort_keys=True))
@ -264,7 +264,7 @@ def main():
logging.debug('found \'vmx\' or \'svm\' in /proc/cpuinfo -> hwvirtex = \'on\'') logging.debug('found \'vmx\' or \'svm\' in /proc/cpuinfo -> hwvirtex = \'on\'')
else: else:
logging.error('hwvirtex = \'on\' and no \'vmx\' or \'svm\' found in /proc/cpuinfo!') logging.error('hwvirtex = \'on\' and no \'vmx\' or \'svm\' found in /proc/cpuinfo!')
exit(1) sys.exit(1)
serverdir = os.path.join(os.getcwd(), 'buildserver') serverdir = os.path.join(os.getcwd(), 'buildserver')
logfilename = os.path.join(serverdir, 'up.log') logfilename = os.path.join(serverdir, 'up.log')

View File

@ -62,7 +62,6 @@ disable = [
"broad-exception-caught", "broad-exception-caught",
"broad-exception-raised", "broad-exception-raised",
"consider-iterating-dictionary", "consider-iterating-dictionary",
"consider-using-sys-exit",
"invalid-name", "invalid-name",
"missing-class-docstring", "missing-class-docstring",
"missing-function-docstring", "missing-function-docstring",

View File

@ -6,6 +6,7 @@ import os
import re import re
import requests import requests
import subprocess import subprocess
import sys
from colorama import Fore, Style from colorama import Fore, Style
from distutils.version import LooseVersion from distutils.version import LooseVersion
@ -92,7 +93,7 @@ with open('gradlew-fdroid', 'w') as fp:
if os.getenv('CI_PROJECT_NAMESPACE') != 'fdroid': if os.getenv('CI_PROJECT_NAMESPACE') != 'fdroid':
p = subprocess.run(['git', '--no-pager', 'diff']) p = subprocess.run(['git', '--no-pager', 'diff'])
print(p.stdout) print(p.stdout)
exit(errors) sys.exit(errors)
# This only runs after commits are pushed to fdroid/fdroidserver # This only runs after commits are pushed to fdroid/fdroidserver
git_repo = git.repo.Repo('.') git_repo = git.repo.Repo('.')
@ -103,7 +104,7 @@ if git_repo.is_dirty() and ('gradlew-fdroid' in modified or 'makebuildserver' in
print(Fore.RED print(Fore.RED
+ 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!' + 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!'
+ Style.RESET_ALL) + Style.RESET_ALL)
exit(1) sys.exit(1)
branch = git_repo.create_head(os.path.basename(__file__), force=True) branch = git_repo.create_head(os.path.basename(__file__), force=True)
branch.checkout() branch.checkout()

View File

@ -7,6 +7,7 @@ import os
import re import re
import requests import requests
import subprocess import subprocess
import sys
from colorama import Fore, Style from colorama import Fore, Style
@ -26,7 +27,7 @@ with open('fdroidserver/common.py') as fp:
to_compile = re.search(r'\nNDKS = [^\]]+\]', common_py).group() to_compile = re.search(r'\nNDKS = [^\]]+\]', common_py).group()
if not to_compile: if not to_compile:
exit(1) sys.exit(1)
code = compile(to_compile, '<string>', 'exec') code = compile(to_compile, '<string>', 'exec')
config = {} config = {}
exec(code, None, config) # nosec this is just a CI script exec(code, None, config) # nosec this is just a CI script
@ -78,7 +79,7 @@ with open('fdroidserver/common.py', 'w') as fp:
if os.getenv('CI_PROJECT_NAMESPACE') != 'fdroid': if os.getenv('CI_PROJECT_NAMESPACE') != 'fdroid':
p = subprocess.run(['git', '--no-pager', 'diff']) p = subprocess.run(['git', '--no-pager', 'diff'])
print(p.stdout) print(p.stdout)
exit(errors) sys.exit(errors)
# This only runs after commits are pushed to fdroid/fdroidserver # This only runs after commits are pushed to fdroid/fdroidserver
@ -114,7 +115,7 @@ if git_repo.is_dirty() and 'fdroidserver/common.py' in modified:
+ 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!' + 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!'
+ Style.RESET_ALL + Style.RESET_ALL
) )
exit(1) sys.exit(1)
gl = gitlab.Gitlab( gl = gitlab.Gitlab(
os.getenv('CI_SERVER_URL'), api_version=4, private_token=private_token os.getenv('CI_SERVER_URL'), api_version=4, private_token=private_token
) )