Beispiel #1
0
    """

    return args


if __name__ == "__main__":

    args = init_options()

    sln = str(args.sln)
    sln = sln.replace('/', '\\')
    if not os.path.isfile(sln):
        print "specified bin file does not exist: ", sln
        exit(0)

    sln_name = get_filename_only(sln)
    sln_projects = set()
    sln_files = set()

    with open(sln, 'r') as fsln:
        sln_results = pickle.load(fsln)

        #convert to lower case because windows path is case insensitive.
        for slnproj in sln_results.projects_in_sln:
            sln_projects.add(slnproj.lower())
        for slnfile in sln_results.files_references:
            sln_files.add(slnfile.lower())

        print "found " + str(len(sln_projects)) + " projects in solution."
        print "found " + str(len(sln_files)) + " files in solution."
Beispiel #2
0
    keep_files = set()

    for keep_sln in args.keepsln:
        keep_sln = keep_sln.replace('/', '\\')
        if not keep_sln.lower().endswith('.bin'):
            print "need .bin file for .sln created using parse_sln"
            exit(0)
        if not os.path.isfile(keep_sln):
            print "specified bin file does not exist: ", keep_sln
            exit(0)

        with open(keep_sln, 'r') as fkeep:
            keep_results = pickle.load(fkeep)

            print " ", get_filename_only(keep_sln),
            print '(' + str(len(keep_results.files)) + ')'

            keep_files = set.union(keep_files, keep_results.files)

    remove_files = set.difference(remove_files, keep_files)

    # since windows file path is case insensitive, we have to do this.
    keep_files_lowercase = set()
    for filepath in keep_files:
        keep_files_lowercase.add(filepath.lower())
    for filepath in remove_files.copy():
        if filepath.lower() in keep_files_lowercase:
            remove_files.remove(filepath)

    print len(remove_files), "files from", repopath, "can be removed."
Beispiel #3
0
        raise Exception("file " + filepath + " is outside gitroot " + git_root)


if __name__ == "__main__":

    args = init_options()

    remove_files = set()

    remove_sln = str(args.remove)
    remove_sln = remove_sln.replace('/', '\\')
    if not os.path.isfile(remove_sln):
        print "specified bin file does not exist: ", remove_sln
        exit(0)

    remove_sln_name = get_filename_only(remove_sln)

    with open(remove_sln, 'r') as fremove:
        remove_results = pickle.load(fremove)

        remove_files = remove_results.files

        print "generating removable files for solution ",
        print remove_sln_name, '(' + str(len(remove_files)) + ')'
        print " while keeping all files for the following solutions:"

    keep_files = set()

    for keep_sln in args.keep:
        keep_sln = keep_sln.replace('/', '\\')
        if not os.path.isfile(keep_sln):