

def __init__(self, base_path, *args, **kwargs):
    base_path = Path(base_path)
    _virtualenv = kwargs.pop('virtualenv')
    path_locations = virtualenv.path_locations(_virtualenv)
    (venv, lib, include, bin) = map(Path, path_locations)
    if hasattr(sys, 'pypy_version_info'):
        lib = os.path.join(venv, 'lib-python', pyversion)
    self.venv_path = venv
    self.lib_path = lib
    self.include_path = include
    self.bin_path = bin
    if hasattr(sys, 'pypy_version_info'):
        self.site_packages_path = self.venv_path.join('site-packages')
    else:
        self.site_packages_path = self.lib_path.join('site-packages')
    self.user_base_path = self.venv_path.join('user')
    self.user_bin_path = self.user_base_path.join((self.bin_path - self.venv_path))
    self.user_site_path = self.venv_path.join('user', site.USER_SITE[(len(site.USER_BASE) + 1):])
    self.scratch_path = base_path.join('scratch').mkdir()
    kwargs.setdefault('cwd', self.scratch_path)
    environ = kwargs.get('environ')
    if (environ is None):
        environ = os.environ.copy()
    environ['PATH'] = Path.pathsep.join(([self.bin_path] + [environ.get('PATH', [])]))
    environ['PYTHONUSERBASE'] = self.user_base_path
    environ['PYTHONDONTWRITEBYTECODE'] = '1'
    kwargs['environ'] = environ
    super(PipTestEnvironment, self).__init__(base_path, *args, **kwargs)
    for name in ['base', 'venv', 'lib', 'include', 'bin', 'site_packages', 'user_base', 'user_site', 'user_bin', 'scratch']:
        real_name = ('%s_path' % name)
        setattr(self, name, (getattr(self, real_name) - self.base_path))
    self.temp_path = Path(self.temp_path)
    self.temp_path.mkdir()
    self.user_site_path.makedirs()
    self.user_site_path.join('easy-install.pth').touch()

dataset/ETHPy150Open pypa/pip/tests/lib/__init__.py PipTestEnvironment.__init__/original