Fix pyroma on Linux

This commit is contained in:
Florian Bruhin 2014-05-06 19:00:35 +02:00
parent 557805c8b2
commit 4a7ccbf131

View File

@ -30,6 +30,7 @@ import subprocess
import os import os
import os.path import os.path
import unittest import unittest
import logging
from collections import OrderedDict from collections import OrderedDict
try: try:
@ -40,6 +41,10 @@ else:
do_check_257 = True do_check_257 = True
from pkg_resources import load_entry_point, DistributionNotFound from pkg_resources import load_entry_point, DistributionNotFound
# We need to do this because pyroma is braindead enough to use logging instead
# of print...
logging.basicConfig(level=logging.INFO, format='%(msg)s')
status = OrderedDict() status = OrderedDict()
options = { options = {
@ -73,12 +78,15 @@ def run(name, args=None):
name: Name of the checker/binary name: Name of the checker/binary
args: Option list of arguments to pass args: Option list of arguments to pass
""" """
sys.argv = [name, options['target']] sys.argv = [name]
if name != 'pyroma':
args.append(options['target'])
if args is not None: if args is not None:
sys.argv += args sys.argv += args
print("====== {} ======".format(name)) print("====== {} ======".format(name))
try: try:
load_entry_point(name, 'console_scripts', name)() ep = load_entry_point(name, 'console_scripts', name)
ep()
except SystemExit as e: except SystemExit as e:
status[name] = e status[name] = e
except DistributionNotFound: except DistributionNotFound: