'Empirically verify whether .pth files are supported in inst. dir'

def check_pth_processing(self):

    instdir = self.install_dir
    log.info('Checking    .pth    file    support    in    %s', instdir)
    pth_file = (self.pseudo_tempname() + '.pth')
    ok_file = (pth_file + '.ok')
    ok_exists = os.path.exists(ok_file)
    try:
        if ok_exists:
            os.unlink(ok_file)
        dirname = os.path.dirname(ok_file)
        if (not os.path.exists(dirname)):
            os.makedirs(dirname)
        f = open(pth_file, 'w')
    except (OSError, IOError):
        self.cant_write_to_target()
    else:
        try:
            f.write(("import    os;    f    =    open(%r,    'w');    f.write('OK');    f.close()\n" % (ok_file,)))
            f.close()
            f = None
            executable = sys.executable
            if (os.name == 'nt'):
                (dirname, basename) = os.path.split(executable)
                alt = os.path.join(dirname, 'pythonw.exe')
                if ((basename.lower() == 'python.exe') and os.path.exists(alt)):
                    executable = alt
            from distutils.spawn import spawn
            spawn([executable, '-E', '-c', 'pass'], 0)
            if os.path.exists(ok_file):
                log.info('TEST    PASSED:    %s    appears    to    support    .pth    files', instdir)
                return True
        finally:
            if f:
                f.close()
            if os.path.exists(ok_file):
                os.unlink(ok_file)
            if os.path.exists(pth_file):
                os.unlink(pth_file)
    if (not self.multi_version):
        log.warn('TEST    FAILED:    %s    does    NOT    support    .pth    files', instdir)
    return False
