'Verify that self.install_dir is .pth-capable dir, if needed'

def check_site_dir(self):

    instdir = normalize_path(self.install_dir)
    pth_file = os.path.join(instdir, 'easy-install.pth')
    is_site_dir = (instdir in self.all_site_dirs)
    if ((not is_site_dir) and (not self.multi_version)):
        is_site_dir = self.check_pth_processing()
    else:
        testfile = (self.pseudo_tempname() + '.write-test')
        test_exists = os.path.exists(testfile)
        try:
            if test_exists:
                os.unlink(testfile)
            open(testfile, 'w').close()
            os.unlink(testfile)
        except (OSError, IOError):
            self.cant_write_to_target()
    if ((not is_site_dir) and (not self.multi_version)):
        raise DistutilsError(self.no_default_version_msg())
    if is_site_dir:
        if (self.pth_file is None):
            self.pth_file = PthDistributions(pth_file, self.all_site_dirs)
    else:
        self.pth_file = None
    PYTHONPATH = os.environ.get('PYTHONPATH', '').split(os.pathsep)
    if (instdir not in map(normalize_path, [_f for _f in PYTHONPATH if _f])):
        self.sitepy_installed = True
    elif (self.multi_version and (not os.path.exists(pth_file))):
        self.sitepy_installed = True
        self.pth_file = None
    self.install_dir = instdir
