示例#1
0
def generate_md5sums():
    installed_files = []
    for root, dirs, files in os.walk('.', topdown=True):
        for name in files:
            filename = os.path.join(root, name)
            md = md5sum(file(filename))
            installed_files.append((filename, md))
    return installed_files
示例#2
0
 def handle_installed_files(self, path, installed_files):
     unchanged_files = []
     _checkifdir(path)
     here = os.getcwd()
     os.chdir(path)
     count = 1
     for filename, md5hash in installed_files:
         self.report_installed_file_handled(filename, count)
         if not os.path.exists(filename):
             print filename, 'non-existant, skipping.'
         else:
             if md5sum(file(filename)) == md5hash:
                 unchanged_files.append(filename)
             else:
                 print filename, 'has changed.'
         count += 1
     os.chdir(here)
     return unchanged_files