(self)
Make sure there's a site.py in the target dir, if needed
Make sure there's a site.py in the target dir, if needed
Make sure there s a site . py in the target dir if needed
def install_site_py(self):
        """Make sure there's a site.py in the target dir, if needed"""

        if self.sitepy_installed:
            return  # already did it, or don't need to

        sitepy = os.path.join(self.install_dir, "site.py")
        source = resource_string("setuptools", "site-patch.py")
        source = source.decode('utf-8')
        current = ""

        if os.path.exists(sitepy):
            log.debug("Checking existing site.py in %s", self.install_dir)
            with io.open(sitepy) as strm:
                current = strm.read()

            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)
                with io.open(sitepy, 'w', encoding='utf-8') as strm:
                    strm.write(source)
            self.byte_compile([sitepy])

        self.sitepy_installed = True
def install_site_py ( self ) : if self . sitepy_installed : return # already did it, or don't need to sitepy = os . path . join ( self . install_dir , "site.py" ) source = resource_string ( "setuptools" , "site-patch.py" ) source = source . decode ( 'utf-8' ) current = "" if os . path . exists ( sitepy ) : log . debug ( "Checking existing site.py in %s" , self . install_dir ) with io . open ( sitepy ) as strm : current = strm . read ( ) 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 ) with io . open ( sitepy , 'w' , encoding = 'utf-8' ) as strm : strm . write ( source ) self . byte_compile ( [ sitepy ] ) self . sitepy_installed = True