Process a ``.pth`` file similar to site.addpackage(...).

def _process_pth(path, base, file_name):
    """Process a ``.pth`` file similar to site.addpackage(...)."""
    
    pth_path = os.path.abspath(os.path.join(base, file_name))
    
    # This is for `exec` below, as some packages (e.g. virtualenvwrapper)
    # assume that `site.addpackage` is running them.
    sitedir = os.path.dirname(base)

    # Only process this once.
    if pth_path in _processed_pths:
        return
    _processed_pths.add(pth_path)    
    
    log.log(1, '_process_pth(..., %r, %r)', base, file_name)
    
    try:
        fh = open(pth_path)
    except IOError as e:
        log.log(1, '_process_path IOError %s' % e)
        return
    
    for line in open(pth_path):
        line = line.strip()
        
        # Blanks and comments.
        if not line or line.startswith('#'):
            continue
        
        # Execs.
        if line.startswith('import'):
            
            # Sorry easy-install: you break our environment.
            if file_name == 'easy-install.pth' and 'sys.__plen' in line:
                continue

            log.log(1, '_process_pth exec %s' % line)
            exec line
            continue
        
        # Replace "{platform_spec}" to allow per-platform paths.
        line = line.format(
            platform_spec=basic_platform_spec,
            basic_platform_spec=basic_platform_spec,
            extended_platform_spec=extended_platform_spec,
        )

        path.add(os.path.join(base, line))