# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):
# 
# Path: muninn/_compat.py
# def path_utf8(path):
#     return path.encode('utf-8')
# 
# def encode(s):
#     return s.encode('utf-8')
# 
# def decode(s):
#     return s.decode('utf-8')


import errno
import hashlib
import os
import shutil
import tempfile
from muninn._compat import string_types as basestring
from muninn._compat import path_utf8, encode, decode
            resolve_root = True

    # If the target is a directory, copy the source _into_ the target, unless the source path ends in a path separator.
    if os.path.isdir(target) and not source.endswith(os.path.sep):
        target = os.path.join(target, os.path.basename(source))

    # Perform the recursive copy.
    _copy_path_rec(source, target, resolve_root, resolve_links)


def remove_path(path):
    if not os.path.isdir(path) or os.path.islink(path):
        os.remove(path)
    else:
        shutil.rmtree(path)


def hash_string(string, hash_func):
    hash = hash_func()
    hash.update(string)
    return encode(hash.hexdigest())


def hash_file(path, block_size, hash_func):
    hash = hash_func()
    with open(path, "rb") as stream:
        while True:
            # Read a block of character data.
            data = stream.read(block_size)
            if not data:

# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):
# 
# Path: muninn/_compat.py
# def path_utf8(path):
#     return path.encode('utf-8')
# 
# def encode(s):
#     return s.encode('utf-8')
# 
# def decode(s):
#     return s.decode('utf-8')


# Path: muninn/util.py
import errno
import hashlib
import os
import shutil
import tempfile
from muninn._compat import string_types as basestring
from muninn._compat import path_utf8, encode, decode

            resolve_root = True

    # If the target is a directory, copy the source _into_ the target, unless the source path ends in a path separator.
    if os.path.isdir(target) and not source.endswith(os.path.sep):
        target = os.path.join(target, os.path.basename(source))

    # Perform the recursive copy.
    _copy_path_rec(source, target, resolve_root, resolve_links)


def remove_path(path):
    if not os.path.isdir(path) or os.path.islink(path):
        os.remove(path)
    else:
        shutil.rmtree(path)


def hash_string(string, hash_func):
    hash = hash_func()
    hash.update(string)
    return encode(hash.hexdigest())


def hash_file(path, block_size, hash_func):
    hash = hash_func()
    with open(path, "rb") as stream:
        while True:
            # Read a block of character data.
            data = stream.read(block_size)
            if not data:

                return encode(hash.hexdigest())