Пример #1
0
    def get_license_parser(self, vague=False):
        '''Get license parser with definitions obtained from a given directory
        :param path: License definitions directory
        '''
        conf_path = helper.path(get_dir(helper.prepend_cwd(config.METADATA_DIR)))
        text_path = helper.path(get_dir(helper.prepend_cwd(config.DEFINITIONS_DIR)))

        (licenses, keywords) = self.get_all_licenses_and_keywords(conf_path, text_path)
        logger.info('Loaded {} licenses'.format(len(licenses)))
        return LicenseParser(keywords, licenses, vague)
Пример #2
0
def run():
    args = argument.construct_argparser().parse_args() # Parse arguments
    argument.handle_args(args)

    logger.print_splash() # Header output

    parser = workflow.get_license_parser(get_dir(config.DEFINITIONS_DIR), vague=args.vague)
    project = workflow.get_project(args.file_list)

    project.licenses, project.online_result = workflow.get_projects_licenses(args, parser, project.files)
    logger.info('Found licenses: {}'.format(', '.join([l.name for l in project.licenses])))
    workflow.display_results(args, project)

    if args.detect_problems:
        workflow.detect_problems(project)
Пример #3
0
 def _format_files(cls, files):
     prefix = get_dir(config.DEFINITIONS_DIR)
     return [helper.path(os.path.join(prefix, f + '.txt')) \
             for f in files.split(' ')]