def _install_system_packages(session):
    "\n    Because some python packages are provided by the distribution and cannot\n    be pip installed, and because we don't want the whole system python packages\n    on our virtualenvs, we copy the required system python packages into\n    the virtualenv\n    "
    version_info = _get_session_python_version_info(session)
    py_version_keys = ['{}'.format(*version_info), '{}.{}'.format(*version_info)]
    session_site_packages_dir = _get_session_python_site_packages_dir(session)
    session_site_packages_dir = os.path.relpath(session_site_packages_dir, REPO_ROOT)
    for py_version in py_version_keys:
        dist_packages_path = '/usr/lib/python{}/dist-packages'.format(py_version)
        if (not os.path.isdir(dist_packages_path)):
            continue
        for aptpkg in glob.glob(os.path.join(dist_packages_path, '*apt*')):
            src = os.path.realpath(aptpkg)
            dst = os.path.join(session_site_packages_dir, os.path.basename(src))
            if os.path.exists(dst):
                session.log('Not overwritting already existing %s with %s', dst, src)
                continue
            session.log('Copying %s into %s', src, dst)
            if os.path.isdir(src):
                shutil.copytree(src, dst)
            else:
                shutil.copyfile(src, dst)
Because some python packages are provided by the distribution and cannot
be pip installed, and because we don't want the whole system python packages
on our virtualenvs, we copy the required system python packages into
the virtualenv
def _install_system_packages(session):
    "\n    Because some python packages are provided by the distribution and cannot\n    be pip installed, and because we don't want the whole system python packages\n    on our virtualenvs, we copy the required system python packages into\n    the virtualenv\n    "
    version_info = _get_session_python_version_info(session)
    py_version_keys = ['{}'.format(*version_info), '{}.{}'.format(*version_info)]
    session_site_packages_dir = _get_session_python_site_packages_dir(session)
    session_site_packages_dir = os.path.relpath(session_site_packages_dir, REPO_ROOT)
    for py_version in py_version_keys:
        dist_packages_path = '/usr/lib/python{}/dist-packages'.format(py_version)
        if (not os.path.isdir(dist_packages_path)):
            continue
        for aptpkg in glob.glob(os.path.join(dist_packages_path, '*apt*')):
            src = os.path.realpath(aptpkg)
            dst = os.path.join(session_site_packages_dir, os.path.basename(src))
            if os.path.exists(dst):
                session.log('Not overwritting already existing %s with %s', dst, src)
                continue
            session.log('Copying %s into %s', src, dst)
            if os.path.isdir(src):
                shutil.copytree(src, dst)
            else:
                shutil.copyfile(src, dst)