From 1644bc47e3c81436d401f29d653d998b2c20e850 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 5 Dec 2014 11:52:23 +0100 Subject: [PATCH] init_venv: Use --system-site-packages on Windows. --- scripts/init_venv.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/init_venv.py b/scripts/init_venv.py index 143d9a358..9ba3a5aaf 100644 --- a/scripts/init_venv.py +++ b/scripts/init_venv.py @@ -108,6 +108,8 @@ def test_toolchain(): def link_pyqt(): """Symlink the systemwide PyQt/sip into the virtualenv.""" + if os.name == 'nt': + return utils.print_title("Softlinking PyQt5") sys_path = distutils.sysconfig.get_python_lib() venv_path = venv_python( @@ -135,6 +137,17 @@ def link_pyqt(): os.symlink(source, link_name) +def create_venv(): + """Create a new virtualenv.""" + utils.print_title("Creating virtualenv") + if os.name == 'nt': + sys_site = ['--system-site-packages'] + else: + sys_site = [] + subprocess.check_call(['virtualenv'] + sys_site + + ['-p', sys.executable, g_path]) + + def main(): """Main entry point.""" global g_path, g_args @@ -144,8 +157,7 @@ def main(): sys.exit(1) g_path = os.path.abspath(g_args.path) check_exists() - utils.print_title("Creating virtualenv") - subprocess.check_call(['virtualenv', '-p', sys.executable, g_path]) + create_venv() utils.print_title("Calling setup.py") venv_python('setup.py', 'develop') if g_args.dev: