def copy_ini_files(*apps, **kwargs):
"""
copy the .ini files from the egg directories to datadir
"""
testfunc = [ lambda x: True ]
# list of files given
if kwargs.get('files', None):
testfunc.append(lambda x: x in kwargs['files'])
else:
testfunc.append(lambda x: True)
# overwite the files
if kwargs.get('overwrite', None):
testfunc.append(lambda x: True)
else:
testfunc.append(lambda x: not os.path.exists(join(datadir), x))
for module in ['tasks'] + [app + '_build' for app in apps]:
dir = module_directory(module)
for f in glob.glob(join(dir, '*.ini')):
inifile = os.path.split(f)[-1]
if sum([func(inifile) for func in testfunc]) == len(testfunc):
shutil.copy(f, datadir)