2 # -*- coding: utf-8 -*-
3 ##############################################################################
4 # Copyright (c) 2017 Luke Hinds <lhinds@redhat.com>, Red Hat
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # from __future__ import division, print_function, absolute_import
14 """Anteater - CI Gate Checks.
17 anteater (-p |--project) <project> [(-ps |--patchset) <patchset>]
18 anteater (-p |--project) <project> [--path <project_path>]
19 anteater (-h | --help)
23 -h --help Show this screen.
24 --version Show version.
26 from __future__ import absolute_import
28 import six.moves.configparser
29 from docopt import docopt
31 from anteater.src.patch_scan import prepare_patchset
32 from anteater.src.project_scan import prepare_project
33 from anteater.utils import anteater_logger as antlog
36 config = six.moves.configparser.RawConfigParser()
37 config.read('anteater.conf')
38 reports_dir = config.get('config', 'reports_dir')
39 logger = antlog.Logger(__name__).getLogger()
44 """ Creates a directory for scan reports """
46 os.makedirs(reports_dir)
47 logger.info('Creating reports directory: {0}'.format(reports_dir))
49 if not os.path.isdir(reports_dir):
54 """ Main function, mostly for passing arguments """
56 arguments = docopt(__doc__, version=__version__)
58 if arguments['<patchset>']:
59 prepare_patchset(arguments['<project>'], arguments['<patchset>'])
60 elif arguments['<project_path>']:
61 prepare_project(arguments['<project>'], arguments['<project_path>'])
64 if __name__ == "__main__":