code: def set_script(self, script):
      
  
      # check if 'script' is a console_script
      dist, entry_point = get_entry_point_from_console_script(script, self._distributions)
      if entry_point:
        self.set_entry_point(entry_point)
        TRACER.log('Set entrypoint to console_script %r in %r' % (entry_point, dist))
        return
  
      # check if 'script' is an ordinary script
      dist, _, _ = get_script_from_distributions(script, self._distributions)
      if dist:
        if self._pex_info.entry_point:
          raise self.InvalidExecutableSpecification('Cannot set both entry point and script of PEX!')
        self._pex_info.script = script
        TRACER.log('Set entrypoint to script %r in %r' % (script, dist))
        return
  
      raise self.InvalidExecutableSpecification(
          'Could not find script %r in any distribution %s within PEX!' % (
              script, ', '.join(str(d) for d in self._distributions)))
docs: Set the entry point of this PEX environment based upon a distribution script.
  
      :param script: The script name as defined either by a console script or ordinary
        script within the setup.py of one of the distributions added to the PEX.
      :raises: :class:`PEXBuilder.InvalidExecutableSpecification` if the script is not found
        in any distribution added to the PEX.