DATA = {
  "Examples": [], 
  "dist": "bob.db.ijba-2.0.2-py_0", 
  "python-scripts": [
    "evaluate_ijba.py", 
    "score_generation.py"
  ], 
  "site-packages": [
    "bob.db.ijba-2.0.2-py3.6.egg-info/PKG-INFO", 
    "bob.db.ijba-2.0.2-py3.6.egg-info/SOURCES.txt", 
    "bob.db.ijba-2.0.2-py3.6.egg-info/dependency_links.txt", 
    "bob.db.ijba-2.0.2-py3.6.egg-info/entry_points.txt", 
    "bob.db.ijba-2.0.2-py3.6.egg-info/not-zip-safe", 
    "bob.db.ijba-2.0.2-py3.6.egg-info/requires.txt", 
    "bob.db.ijba-2.0.2-py3.6.egg-info/top_level.txt", 
    "bob/db/ijba/__init__.py", 
    "bob/db/ijba/data/IJB-A_11_sets/split1/train_1.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split1/verify_comparisons_1.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split1/verify_metadata_1.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split10/train_10.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split10/verify_comparisons_10.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split10/verify_metadata_10.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split2/train_2.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split2/verify_comparisons_2.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split2/verify_metadata_2.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split3/train_3.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split3/verify_comparisons_3.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split3/verify_metadata_3.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split4/train_4.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split4/verify_comparisons_4.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split4/verify_metadata_4.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split5/train_5.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split5/verify_comparisons_5.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split5/verify_metadata_5.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split6/train_6.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split6/verify_comparisons_6.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split6/verify_metadata_6.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split7/train_7.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split7/verify_comparisons_7.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split7/verify_metadata_7.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split8/train_8.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split8/verify_comparisons_8.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split8/verify_metadata_8.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split9/train_9.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split9/verify_comparisons_9.csv", 
    "bob/db/ijba/data/IJB-A_11_sets/split9/verify_metadata_9.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split1/search_gallery_1.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split1/search_probe_1.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split1/train_1.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split10/search_gallery_10.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split10/search_probe_10.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split10/train_10.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split2/search_gallery_2.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split2/search_probe_2.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split2/train_2.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split3/search_gallery_3.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split3/search_probe_3.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split3/train_3.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split4/search_gallery_4.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split4/search_probe_4.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split4/train_4.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split5/search_gallery_5.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split5/search_probe_5.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split5/train_5.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split6/search_gallery_6.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split6/search_probe_6.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split6/train_6.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split7/search_gallery_7.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split7/search_probe_7.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split7/train_7.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split8/search_gallery_8.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split8/search_probe_8.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split8/train_8.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split9/search_gallery_9.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split9/search_probe_9.csv", 
    "bob/db/ijba/data/IJB-A_1N_sets/split9/train_9.csv", 
    "bob/db/ijba/driver.py", 
    "bob/db/ijba/files.txt", 
    "bob/db/ijba/query.py", 
    "bob/db/ijba/reader.py", 
    "bob/db/ijba/scripts/__init__.py", 
    "bob/db/ijba/scripts/evaluate_ijba.py", 
    "bob/db/ijba/scripts/score_generation.py", 
    "bob/db/ijba/test.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()
