def _consolidate_package_data_files(original_package_data, package_prefixes, hide_listing):
    "This function copies package data files specified using the ``package_data`` keyword\n    into :func:`.constants.CMAKE_INSTALL_DIR()`.\n\n    ::\n\n        setup(...,\n            packages=['mypkg'],\n            package_dir={'mypkg': 'src/mypkg'},\n            package_data={'mypkg': ['data/*.dat']},\n            )\n\n    Considering that (1) the packages associated with modules located in both the source tree and\n    the CMake install tree are consolidated into the CMake install tree, and (2) the consolidated\n    package path set in the ``package_dir`` dictionary and later used by setuptools to package\n    (or install) modules and data files is :func:`.constants.CMAKE_INSTALL_DIR()`, copying the data files\n    is required to ensure setuptools can find them when it uses the package directory.\n    "
    project_root = os.getcwd()
    for (prefix, package) in package_prefixes:
        if (package not in original_package_data):
            continue
        raw_patterns = original_package_data[package]
        for pattern in raw_patterns:
            expanded_package_dir = os.path.join(project_root, prefix, pattern)
            for src_data_file in glob(expanded_package_dir):
                full_prefix_length = (len(os.path.join(project_root, prefix)) + 1)
                data_file = src_data_file[full_prefix_length:]
                dest_data_file = os.path.join(CMAKE_INSTALL_DIR(), prefix, data_file)
                _copy_file(src_data_file, dest_data_file, hide_listing)
This function copies package data files specified using the ``package_data`` keyword
into :func:`.constants.CMAKE_INSTALL_DIR()`.

::

    setup(...,
        packages=['mypkg'],
        package_dir={'mypkg': 'src/mypkg'},
        package_data={'mypkg': ['data/*.dat']},
        )

Considering that (1) the packages associated with modules located in both the source tree and
the CMake install tree are consolidated into the CMake install tree, and (2) the consolidated
package path set in the ``package_dir`` dictionary and later used by setuptools to package
(or install) modules and data files is :func:`.constants.CMAKE_INSTALL_DIR()`, copying the data files
is required to ensure setuptools can find them when it uses the package directory.
def _consolidate_package_data_files(original_package_data, package_prefixes, hide_listing):
    "This function copies package data files specified using the ``package_data`` keyword\n    into :func:`.constants.CMAKE_INSTALL_DIR()`.\n\n    ::\n\n        setup(...,\n            packages=['mypkg'],\n            package_dir={'mypkg': 'src/mypkg'},\n            package_data={'mypkg': ['data/*.dat']},\n            )\n\n    Considering that (1) the packages associated with modules located in both the source tree and\n    the CMake install tree are consolidated into the CMake install tree, and (2) the consolidated\n    package path set in the ``package_dir`` dictionary and later used by setuptools to package\n    (or install) modules and data files is :func:`.constants.CMAKE_INSTALL_DIR()`, copying the data files\n    is required to ensure setuptools can find them when it uses the package directory.\n    "
    project_root = os.getcwd()
    for (prefix, package) in package_prefixes:
        if (package not in original_package_data):
            continue
        raw_patterns = original_package_data[package]
        for pattern in raw_patterns:
            expanded_package_dir = os.path.join(project_root, prefix, pattern)
            for src_data_file in glob(expanded_package_dir):
                full_prefix_length = (len(os.path.join(project_root, prefix)) + 1)
                data_file = src_data_file[full_prefix_length:]
                dest_data_file = os.path.join(CMAKE_INSTALL_DIR(), prefix, data_file)
                _copy_file(src_data_file, dest_data_file, hide_listing)