Virtualenv: library isolated for Python

Comment 3 for bug 352844

Robert Myers (rmyers) wrote :

The problem is that the pythonXX.dll is missing when you install for 'only this user'. Copying the correct dll into the virtual env scripts folder fixes this issue.

Anywhere before the test "[py_executable, '-c', 'import sys; print sys.prefix']" place the lines:

# Fix python on windows if installed for 'only this user'
    if sys.platform == 'win32':
        # Windows 'may' be installed for 'Only this user' so lets fix it and try again.
        python_dll = os.path.join(os.path.dirname(sys.executable),
            'python%s%s.dll' % (sys.version_info[0], sys.version_info[1]))
        if os.path.isfile(python_dll):
            shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable),
                'python%s%s.dll' % (sys.version_info[0], sys.version_info[1])))