DATA = {
  "Examples": [], 
  "dist": "bob.bio.face-3.1.0-py_0", 
  "python-scripts": [
    "baselines.py", 
    "display_face_annotations.py"
  ], 
  "site-packages": [
    "bob.bio.face-3.1.0-py3.6.egg-info/PKG-INFO", 
    "bob.bio.face-3.1.0-py3.6.egg-info/SOURCES.txt", 
    "bob.bio.face-3.1.0-py3.6.egg-info/dependency_links.txt", 
    "bob.bio.face-3.1.0-py3.6.egg-info/entry_points.txt", 
    "bob.bio.face-3.1.0-py3.6.egg-info/not-zip-safe", 
    "bob.bio.face-3.1.0-py3.6.egg-info/requires.txt", 
    "bob.bio.face-3.1.0-py3.6.egg-info/top_level.txt", 
    "bob/bio/face/__init__.py", 
    "bob/bio/face/algorithm/GaborJet.py", 
    "bob/bio/face/algorithm/Histogram.py", 
    "bob/bio/face/algorithm/__init__.py", 
    "bob/bio/face/config/__init__.py", 
    "bob/bio/face/config/algorithm/__init__.py", 
    "bob/bio/face/config/algorithm/bic_jets.py", 
    "bob/bio/face/config/algorithm/gabor_jet.py", 
    "bob/bio/face/config/algorithm/histogram.py", 
    "bob/bio/face/config/database/__init__.py", 
    "bob/bio/face/config/database/arface.py", 
    "bob/bio/face/config/database/atnt.py", 
    "bob/bio/face/config/database/banca_english.py", 
    "bob/bio/face/config/database/caspeal.py", 
    "bob/bio/face/config/database/frgc.py", 
    "bob/bio/face/config/database/gbu.py", 
    "bob/bio/face/config/database/lfw_restricted.py", 
    "bob/bio/face/config/database/lfw_unrestricted.py", 
    "bob/bio/face/config/database/mobio.py", 
    "bob/bio/face/config/database/msu_mfsd_mod.py", 
    "bob/bio/face/config/database/multipie.py", 
    "bob/bio/face/config/database/multipie_pose.py", 
    "bob/bio/face/config/database/replay.py", 
    "bob/bio/face/config/database/replaymobile.py", 
    "bob/bio/face/config/database/scface.py", 
    "bob/bio/face/config/database/xm2vts.py", 
    "bob/bio/face/config/extractor/__init__.py", 
    "bob/bio/face/config/extractor/dct_blocks.py", 
    "bob/bio/face/config/extractor/eigenface.py", 
    "bob/bio/face/config/extractor/grid_graph.py", 
    "bob/bio/face/config/extractor/lgbphs.py", 
    "bob/bio/face/config/preprocessor/__init__.py", 
    "bob/bio/face/config/preprocessor/base.py", 
    "bob/bio/face/config/preprocessor/face_crop_eyes.py", 
    "bob/bio/face/config/preprocessor/face_detect.py", 
    "bob/bio/face/config/preprocessor/histogram_equalization.py", 
    "bob/bio/face/config/preprocessor/inorm_lbp.py", 
    "bob/bio/face/config/preprocessor/self_quotient_image.py", 
    "bob/bio/face/config/preprocessor/tan_triggs.py", 
    "bob/bio/face/database/__init__.py", 
    "bob/bio/face/database/arface.py", 
    "bob/bio/face/database/atnt.py", 
    "bob/bio/face/database/banca.py", 
    "bob/bio/face/database/caspeal.py", 
    "bob/bio/face/database/cuhk_cufs.py", 
    "bob/bio/face/database/database.py", 
    "bob/bio/face/database/frgc.py", 
    "bob/bio/face/database/gbu.py", 
    "bob/bio/face/database/ijba.py", 
    "bob/bio/face/database/lfw.py", 
    "bob/bio/face/database/mobio.py", 
    "bob/bio/face/database/msu_mfsd_mod.py", 
    "bob/bio/face/database/multipie.py", 
    "bob/bio/face/database/replay.py", 
    "bob/bio/face/database/replaymobile.py", 
    "bob/bio/face/database/scface.py", 
    "bob/bio/face/database/xm2vts.py", 
    "bob/bio/face/extractor/DCTBlocks.py", 
    "bob/bio/face/extractor/Eigenface.py", 
    "bob/bio/face/extractor/GridGraph.py", 
    "bob/bio/face/extractor/LGBPHS.py", 
    "bob/bio/face/extractor/__init__.py", 
    "bob/bio/face/preprocessor/Base.py", 
    "bob/bio/face/preprocessor/FaceCrop.py", 
    "bob/bio/face/preprocessor/FaceDetect.py", 
    "bob/bio/face/preprocessor/HistogramEqualization.py", 
    "bob/bio/face/preprocessor/INormLBP.py", 
    "bob/bio/face/preprocessor/SelfQuotientImage.py", 
    "bob/bio/face/preprocessor/TanTriggs.py", 
    "bob/bio/face/preprocessor/__init__.py", 
    "bob/bio/face/preprocessor/utils.py", 
    "bob/bio/face/script/__init__.py", 
    "bob/bio/face/script/baselines.py", 
    "bob/bio/face/script/display_face_annotations.py", 
    "bob/bio/face/test/__init__.py", 
    "bob/bio/face/test/data/cropped.hdf5", 
    "bob/bio/face/test/data/dct_blocks.hdf5", 
    "bob/bio/face/test/data/detected.hdf5", 
    "bob/bio/face/test/data/eigenface_extractor.hdf5", 
    "bob/bio/face/test/data/eigenface_feature.hdf5", 
    "bob/bio/face/test/data/flandmark.hdf5", 
    "bob/bio/face/test/data/graph_regular.hdf5", 
    "bob/bio/face/test/data/histogram_cropped.hdf5", 
    "bob/bio/face/test/data/inorm_lbp_cropped.hdf5", 
    "bob/bio/face/test/data/lgbphs_sparse.hdf5", 
    "bob/bio/face/test/data/lgbphs_with_phase.hdf5", 
    "bob/bio/face/test/data/self_quotient_cropped.hdf5", 
    "bob/bio/face/test/data/tan_triggs_cropped.hdf5", 
    "bob/bio/face/test/data/tan_triggs_none.hdf5", 
    "bob/bio/face/test/data/testimage.jpg", 
    "bob/bio/face/test/data/testimage.pos", 
    "bob/bio/face/test/test_algorithms.py", 
    "bob/bio/face/test/test_databases.py", 
    "bob/bio/face/test/test_extractors.py", 
    "bob/bio/face/test/test_preprocessors.py", 
    "bob/bio/face/test/test_scripts.py"
  ]
}
## END DATA

"""
This is code that is added to noarch Python packages. See
conda_build/noarch_python.py.

"""
import os
from os.path import dirname, exists, isdir, join, normpath
import sys
import shutil


# Silence pyflakes. This variable is added when link.py is written by
# conda_build.noarch_python.
if False:
    DATA = None

THIS_DIR = dirname(__file__)
PREFIX = normpath(sys.prefix)
if sys.platform == 'win32':
    BIN_DIR = join(PREFIX, 'Scripts')
    SITE_PACKAGES = 'Lib/site-packages'
else:
    BIN_DIR = join(PREFIX, 'bin')
    SITE_PACKAGES = 'lib/python%s/site-packages' % sys.version[:3]

# the list of these files is going to be store in info/_files
FILES = []


def _link(src, dst):
    try:
        os.link(src, dst)
        # on Windows os.link raises AttributeError
    except (OSError, AttributeError):
        shutil.copy2(src, dst)


def _unlink(path):
    try:
        os.unlink(path)
    except OSError:
        pass


def pyc_f(f, version_info=sys.version_info):
    if version_info[0] == 2:
        return f + 'c'
    dn, fn = f.rsplit('/', 1)
    return '%s/__pycache__/%s.cpython-%d%d.pyc' % (
              dn, fn[:-3], version_info[0], version_info[1])


def link_files(src_root, dst_root, files):
    for f in files:
        src = join(THIS_DIR, src_root, f)
        dst = join(PREFIX, dst_root, f)
        dst_dir = dirname(dst)
        if not isdir(dst_dir):
            os.makedirs(dst_dir)
        if exists(dst):
            _unlink(dst)
        _link(src, dst)
        f = '%s/%s' % (dst_root, f)
        FILES.append(f)
        if f.endswith('.py'):
            FILES.append(pyc_f(f))


def create_script(fn):
    src = join(THIS_DIR, 'python-scripts', fn)
    dst = join(BIN_DIR, fn)
    if sys.platform == 'win32':
        shutil.copy2(src, dst + '-script.py')
        FILES.append('Scripts/%s-script.py' % fn)
        shutil.copy2(join(THIS_DIR,
                          'cli-%d.exe' % (8 * tuple.__itemsize__)),
                     dst + '.exe')
        FILES.append('Scripts/%s.exe' % fn)
    else:
        with open(src) as fi:
            data = fi.read()
        with open(dst, 'w') as fo:
            fo.write('#!%s\n' % normpath(sys.executable))
            fo.write(data)
        os.chmod(dst, 0o775)
        FILES.append('bin/%s' % fn)


def create_scripts(files):
    if not files:
        return
    if not isdir(BIN_DIR):
        os.mkdir(BIN_DIR)
    for fn in files:
        create_script(fn)


def main():
    create_scripts(DATA['python-scripts'])
    link_files('site-packages', SITE_PACKAGES, DATA['site-packages'])
    link_files('Examples', 'Examples', DATA['Examples'])

    with open(join(PREFIX, 'conda-meta',
                   '%s.files' % DATA['dist']), 'w') as fo:
        for f in FILES:
            fo.write('%s\n' % f)


if __name__ == '__main__':
    main()
