From f3d570dd5b8b1f3ba14197f8dd2bb30b8b303650 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 23 Jan 2015 18:32:33 +0100 Subject: [PATCH] venv: Only copy needed files on Windows. --- scripts/init_venv.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/init_venv.py b/scripts/init_venv.py index 7f6116ef6..fc0724e88 100644 --- a/scripts/init_venv.py +++ b/scripts/init_venv.py @@ -121,6 +121,12 @@ def test_toolchain(): venv_python('-c', 'import {}'.format(pkg)) +def get_ignored_files(dir, files): + """Get the files which should be ignored for link_pyqt() on Windows.""" + needed_exts = ('py', 'dll', 'pyd') + return [f for f in files if os.path.splitext(f)[1] not in needed_exts] + + def link_pyqt(): """Symlink the systemwide PyQt/sip into the venv.""" action = "Copying" if os.name == 'nt' else "Softlinking" @@ -150,7 +156,7 @@ def link_pyqt(): print('{} -> {}'.format(source, dest)) if os.name == 'nt': if os.path.isdir(source): - shutil.copytree(source, dest) + shutil.copytree(source, dest, ignore=get_ignored_files) else: shutil.copy(source, dest) else: