示例#1
0
文件: hashstore.py 项目: lurch/moban
    def _is_source_updated(self, file_name, file_content, source_template):
        changed = True
        content = _mix(file_content,
                       oct(utils.file_permissions(source_template)))
        content_hash = get_hash(content)
        if os.path.exists(file_name):
            if file_name in self.hashes:
                if content_hash == self.hashes[file_name]:
                    changed = False
        # else the dest file has not been created yet
        # so no need to get content hash at all
        if changed:
            self.hashes[file_name] = content_hash

        return changed
示例#2
0
文件: hashstore.py 项目: lurch/moban
def get_file_hash(afile):
    with open(afile, "rb") as handle:
        content = handle.read()
    content = _mix(content, oct(utils.file_permissions(afile)))
    return get_hash(content)
示例#3
0
def test_file_permissions_file_not_found():
    file_permissions("I does not exist")
示例#4
0
def file_permissions_disabled_on_windows():
    if sys.platform == "win32":
        permissions = file_permissions("abc")
        eq_("no-permission-support", permissions)
    else:
        raise SkipTest("No test required")