# Path: simiki/compat.py

# 
# Path: simiki/utils.py
# def copytree(src, dst, symlinks=False, ignore=None):
#     """Copy from source directory to destination"""
# 
#     if not os.path.exists(dst):
#         os.makedirs(dst)
#     for item in os.listdir(src):
#         s = os.path.join(src, item)
#         d = os.path.join(dst, item)
#         if os.path.isdir(s):
#             copytree(s, d, symlinks, ignore)
#         else:
#             shutil.copy2(s, d)
# 
# def get_md5(filename):
#     # py3 require md5 with bytes object, otherwise raise
#     # TypeError: Unicode-objects must be encoded before hashing
#     with open(filename, 'rb') as fd:
#         md5_hash = hashlib.md5(fd.read()).hexdigest()
#     return md5_hash


import os
import shutil
import logging
from simiki.compat import raw_input
from simiki.utils import copytree, get_md5

                for fn in files:
                    original_fn_md5 = get_md5(os.path.join(root, fn))

                    local_fn = os.path.join(local_dir, rel_dir, fn)
                    if not os.path.exists(local_fn):
                        _need_update = True
                        break
                    local_fn_md5 = get_md5(local_fn)
                    if local_fn_md5 != original_fn_md5:
                        _need_update = True
                        break
                if _need_update:
                    break

            if _need_update:
                up_to_date = False
                try:
                    _ans = get_input('Overwrite {0} {1}? (y/N) '
                                     .format(tag, dirname))
                    if _ans.lower() in yes_answer:
                        shutil.rmtree(local_dir)
                        copytree(original_dir, local_dir)
                except (KeyboardInterrupt, SystemExit):
                    print()
        else:
            up_to_date = False
            try:
                _ans = get_input('New {0} {1}? (y/N) '.format(tag, dirname))
                if _ans.lower() in yes_answer:

# Path: simiki/compat.py

# 
# Path: simiki/utils.py
# def copytree(src, dst, symlinks=False, ignore=None):
#     """Copy from source directory to destination"""
# 
#     if not os.path.exists(dst):
#         os.makedirs(dst)
#     for item in os.listdir(src):
#         s = os.path.join(src, item)
#         d = os.path.join(dst, item)
#         if os.path.isdir(s):
#             copytree(s, d, symlinks, ignore)
#         else:
#             shutil.copy2(s, d)
# 
# def get_md5(filename):
#     # py3 require md5 with bytes object, otherwise raise
#     # TypeError: Unicode-objects must be encoded before hashing
#     with open(filename, 'rb') as fd:
#         md5_hash = hashlib.md5(fd.read()).hexdigest()
#     return md5_hash


# Path: simiki/updater.py
import os
import shutil
import logging
from simiki.compat import raw_input
from simiki.utils import copytree, get_md5


                for fn in files:
                    original_fn_md5 = get_md5(os.path.join(root, fn))

                    local_fn = os.path.join(local_dir, rel_dir, fn)
                    if not os.path.exists(local_fn):
                        _need_update = True
                        break
                    local_fn_md5 = get_md5(local_fn)
                    if local_fn_md5 != original_fn_md5:
                        _need_update = True
                        break
                if _need_update:
                    break

            if _need_update:
                up_to_date = False
                try:
                    _ans = get_input('Overwrite {0} {1}? (y/N) '
                                     .format(tag, dirname))
                    if _ans.lower() in yes_answer:
                        shutil.rmtree(local_dir)
                        copytree(original_dir, local_dir)
                except (KeyboardInterrupt, SystemExit):
                    print()
        else:
            up_to_date = False
            try:
                _ans = get_input('New {0} {1}? (y/N) '.format(tag, dirname))
                if _ans.lower() in yes_answer:

                    copytree(original_dir, local_dir)