diff --git a/tools/python/score.py b/tools/python/score.py index f4e9d09a..a9e07ddf 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -2,30 +2,44 @@ import re import sys import argparse import time +import os from file_util import FileUtil from score_display import ScoreDisplay ASM_FOLDERS = [ - './asm/unknown_0251F0', - './asm/unknown_031D30', - './asm/unknown_062930', - './asm/unknown_070110', - './asm/gzip', + './asm', './lib/asm', - './lib/asm/exception', ] +BLACKLIST = [ + '/non_matchings/' +] + +filelist = [] + +for asmDir in ASM_FOLDERS: + for root, dirs, files in os.walk(asmDir): + for file in files: + fullPath = os.path.join(root,file) + skipThis = False + for blackListEntry in BLACKLIST: + if blackListEntry in fullPath: + skipThis = True + break + if not skipThis and fullPath.endswith('.s'): + filelist.append(fullPath) + # These will automatically be added to the adventure one percentage. -ASM_LABELS = [ 'entrypoint' ] -for folder in ASM_FOLDERS: - GLABEL_REGEX = r'glabel ([0-9A-Za-z_]+)' - filenames = FileUtil.get_filenames_from_directory(folder, extensions=('.s',)) - for filename in filenames: - with open(folder + '/' + filename, 'r') as asmFile: - text = asmFile.read() - matches = re.finditer(GLABEL_REGEX, text, re.MULTILINE) - for matchNum, match in enumerate(matches, start=1): - ASM_LABELS.append(match.groups()[0]) +ASM_LABELS = [] +GLABEL_REGEX = r'glabel ([0-9A-Za-z_]+)' +for filename in filelist: + with open(filename, 'r') as asmFile: + text = asmFile.read() + matches = re.finditer(GLABEL_REGEX, text, re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + glabel = match.groups()[0] + if not glabel in ASM_LABELS: + ASM_LABELS.append(glabel) BUILD_DIRECTORY = './build/us_1.0' SRC_DIRECTORY = './src'