capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/easy_install.py
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")
        current = ""

        if os.path.exists(sitepy):
            log.debug("Checking existing site.py in %s", self.install_dir)
            f = open(sitepy, 'rb')
            current = f.read()
            # we want str, not bytes
            if PY3:
                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
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")
        current = ""

        if os.path.exists(sitepy):
            log.debug("Checking existing site.py in %s", self.install_dir)
            f = open(sitepy, 'rb')
            current = f.read()
            # we want str, not bytes
            if PY3:
                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
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" ) current = "" if os . path . exists ( sitepy ) : log . debug ( "Checking existing site.py in %s" , self . install_dir ) f = open ( sitepy , 'rb' ) current = f . read ( ) # we want str, not bytes if PY3 : 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
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