예제 #1
0
파일: project.py 프로젝트: inlinechan/stags
 def get_files_from_db(dbname):
     if os.path.exists(dbname):
         parsed_dict = Storage(dbname, 'r')
         files = parsed_dict.get(FILES, None)
         logging.debug('get_files_from_db: dbname: {}, files: {}'.format(dbname, files))
         parsed_dict.close()
         return files
     else:
         return None
예제 #2
0
파일: project.py 프로젝트: inlinechan/stags
        sys.exit(0)
    elif action == 'parse':
        scanned_list = project.scan()
        files = project.get_files_from_db(dbname)

        pp.pprint(files)

        if files:
            scanned_list = project.scan_modified(scanned_list, files)
            logging.debug('scanned_list: {}'.format([x[0] for x in scanned_list]))

        parsed_dict = project.parse_all(scanned_list)
        pp.pprint('Parsed {} in {} with keys'.format(len(parsed_dict), builddir))
        pp.pprint(parsed_dict.keys())
    elif action == 'parse_single':
        scanned_list = project.scan()
        files = project.get_files_from_db(dbname)

        if files:
            scanned_list = project.scan_modified(scanned_list, files)

        parsed_dict = project.parse_all_single(scanned_list)
        pp.pprint('Parsed {} in {} with keys'.format(len(parsed_dict), builddir))
        pp.pprint(parsed_dict.keys())

    storage = Storage(dbname, writeback=True)
    storage_update = util.measure(storage.update)

    merge_recurse_inplace(storage, parsed_dict, Storage)
    storage.close()