import re
from distutils import file_util, dir_util

def wrapper(fn):

    def wrapped(src, *args, **kwargs):
        if not re.search('/\\.git/?', src):
            fn(src, *args, **kwargs)
return wrapped
file_util.copy_file = wrapper(file_util.copy_file)
dir_util.mkpath = wrapper(dir_util.mkpath)
from setuptools import setup
py2app picking up .git subdir of a package during build