summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/test
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2023-02-12 04:54:28 (GMT)
committerGitHub <noreply@github.com>2023-02-12 04:54:28 (GMT)
commit1d194235e4d5981b5fea25c75318d61189103a58 (patch)
treeae4eb3ce046118bcafa828044d71ae502387dc02 /Tools/freeze/test
parent3eb12df8b526aa5a2ca6b43f21a1c5e7d38ee634 (diff)
downloadcpython-1d194235e4d5981b5fea25c75318d61189103a58.zip
cpython-1d194235e4d5981b5fea25c75318d61189103a58.tar.gz
cpython-1d194235e4d5981b5fea25c75318d61189103a58.tar.bz2
gh-89792: Prevent test_tools from copying 1000M of "source" in freeze test (#101837)
Prevent test_tools from copying 1000M of "source" It doesn't need a git repo, just the checkout. We skip .git metadata, Doc/build, Doc/venv, and `__pycache__` subdirs, that developers often have in their clients to reduce the size of the source tree copy ten-fold. This should significantly reduce IO and presumably time on buildbots during this long test.
Diffstat (limited to 'Tools/freeze/test')
-rw-r--r--Tools/freeze/test/freeze.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Tools/freeze/test/freeze.py b/Tools/freeze/test/freeze.py
index ddbfd7f..0ae983b 100644
--- a/Tools/freeze/test/freeze.py
+++ b/Tools/freeze/test/freeze.py
@@ -80,7 +80,19 @@ def copy_source_tree(newroot, oldroot):
if newroot == SRCDIR:
raise Exception('this probably isn\'t what you wanted')
shutil.rmtree(newroot)
- shutil.copytree(oldroot, newroot)
+
+ def ignore_non_src(src, names):
+ """Turns what could be a 1000M copy into a 100M copy."""
+ # Don't copy the ~600M+ of needless git repo metadata.
+ # source only, ignore cached .pyc files.
+ subdirs_to_skip = {'.git', '__pycache__'}
+ if os.path.basename(src) == 'Doc':
+ # Another potential ~250M+ of non test related data.
+ subdirs_to_skip.add('build')
+ subdirs_to_skip.add('venv')
+ return subdirs_to_skip
+
+ shutil.copytree(oldroot, newroot, ignore=ignore_non_src)
if os.path.exists(os.path.join(newroot, 'Makefile')):
_run_quiet([MAKE, 'clean'], newroot)