'Make sure there\'s a site.py in the target dir, if needed'

def install_site_py(self):

    if self.sitepy_installed:
        return
    sitepy = os.path.join(self.install_dir, 'site.py')
    source = resource_string('setuptools', 'site-patch.py')
    current = ''
    if os.path.exists(sitepy):
        log.debug('Checking    existing    site.py    in    %s', self.install_dir)
        f = open(sitepy, 'rb')
        current = f.read()
        if (sys.version_info >= (3,)):
            current = current.decode()
        f.close()
        if (not current.startswith('def    __boot():')):
            raise DistutilsError(('%s    is    not    a    setuptools-generated    site.py;    please    remove    it.' % sitepy))
    if (current != source):
        log.info('Creating    %s', sitepy)
        if (not self.dry_run):
            ensure_directory(sitepy)
            f = open(sitepy, 'wb')
            f.write(source)
            f.close()
        self.byte_compile([sitepy])
    self.sitepy_installed = True
