Example #1
0
def processAssignment(archive, path, options):
    targets = extractFromArchive(archive, path)
    author = os.path.split(path)[1]
    current = os.getcwd()
    os.chdir(path)
    master = {}
    for filename in targets:
        if os.path.isdir(os.path.join(path, filename)):
            pass
        else:
            temp = examine(filename, options)
            for tup in temp:
                entry = Entry(*tup, auth=author, loc=os.path.abspath(filename))
                if tup.hash in master:
                    master[tup.hash].append(entry)
                else:
                    master[tup.hash] = [ entry ]
                             
    os.chdir(current)
    return master
Example #2
0
def processAssignment(archive, path, options):
    targets = extractFromArchive(archive, path)
    author = os.path.split(path)[1]
    current = os.getcwd()
    os.chdir(path)
    master = {}
    for filename in targets:
        if os.path.isdir(os.path.join(path, filename)):
            pass
        else:
            temp = examine(filename, options)
            for tup in temp:
                entry = Entry(*tup, auth=author, loc=os.path.abspath(filename))
                if tup.hash in master:
                    master[tup.hash].append(entry)
                else:
                    master[tup.hash] = [entry]

    os.chdir(current)
    return master
Example #3
0
def processFolder(path, merge, author, options):
    """Returns fingerprints of all files found in folder
    Runs recursively on all folders found there of. Adds all fingerprints to
    the dictionary its passed."""

    #Path juggling.
    current = os.getcwd()
    os.chdir(path)
    targets = os.listdir(".")

    for entry in targets:
        if os.path.isdir(entry):  #If folder, recurse.
            processFolder(entry, merge, author, options)
        else:
            temp = examine(entry, options)
            for tup in temp:  #Add to dictionary.
                entry = Entry(*tup, auth=author, path=os.path.abspath(entry))
                createOrAppend(merge, tup.hash, entry)

    os.chdir(current)
Example #4
0
def processFolder(path, merge, author, options):
    
    """Returns fingerprints of all files found in folder
    Runs recursively on all folders found there of. Adds all fingerprints to
    the dictionary its passed."""
    
    #Path juggling.
    current = os.getcwd()
    os.chdir(path)
    targets = os.listdir(".")

    for entry in targets:
        if os.path.isdir(entry): #If folder, recurse.
            processFolder(entry, merge, author, options)
        else:
            temp = examine(entry, options)
            for tup in temp: #Add to dictionary.
                entry = Entry(*tup, auth=author, path=os.path.abspath(entry))
                createOrAppend(merge, tup.hash, entry) 

    os.chdir(current)