Skip to content

Commit 50d094d

Browse files
authored
Fix asv test disk space issue (#2673)
#### Reference Issues/PRs <!--Example: Fixes #1234. See also #3456.--> https://man312219.monday.com/boards/7852509418/pulses/18063353838 #### What does this implement or fix? github runner image has secretly reduced the disk space available in a recent upgrade Fix the storage space issue by reducing the footprint of the build #### Any other comments? #### Checklist <details> <summary> Checklist for code changes... </summary> - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes? </details> <!-- Thanks for contributing a Pull Request to ArcticDB! Please ensure you have taken a look at: - ArcticDB's Code of Conduct: https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md - ArcticDB's Contribution Licensing: https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing -->
1 parent 7210ae0 commit 50d094d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

setup.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import shutil
77
import re
88
from tempfile import mkdtemp
9+
from pathlib import Path
910
from setuptools import setup, Command, find_namespace_packages
1011
from setuptools import Extension, find_packages
1112
from setuptools.command.build_ext import build_ext
@@ -30,6 +31,45 @@ def _log_and_run(*cmd, **kwargs):
3031
print("Running " + " ".join(cmd))
3132
subprocess.check_call(cmd, **kwargs)
3233

34+
def cleanup_vcpkg_artifacts():
35+
cpp_dir = Path("cpp")
36+
if not cpp_dir.exists():
37+
return
38+
39+
vcpkg_dir = cpp_dir / "vcpkg"
40+
if not vcpkg_dir.exists():
41+
return
42+
43+
def safe_remove_directory(dir_path):
44+
# To handle Windows symbolic links
45+
if not dir_path.exists():
46+
print(f"Directory not found (skipping): {dir_path}")
47+
return
48+
49+
try:
50+
if os.path.islink(str(dir_path)):
51+
target = os.readlink(str(dir_path))
52+
if os.path.isabs(target):
53+
target_path = Path(target)
54+
else:
55+
target_path = dir_path.parent / target
56+
57+
os.unlink(str(dir_path))
58+
print(f"Removed symbolic link: {dir_path}")
59+
60+
if target_path.exists() and target_path.is_dir():
61+
shutil.rmtree(str(target_path))
62+
print(f"Removed target directory: {target_path}")
63+
else:
64+
shutil.rmtree(str(dir_path))
65+
print(f"Removed: {dir_path}")
66+
except Exception as e:
67+
print(f"Warning: Could not remove {dir_path}: {e}")
68+
69+
safe_remove_directory(vcpkg_dir / "buildtrees")
70+
safe_remove_directory(vcpkg_dir / "downloads")
71+
safe_remove_directory(vcpkg_dir / "packages")
72+
3373

3474
class CompileProto(Command):
3575
# When adding new protobuf versions, also update: setup.cfg, python/arcticdb/__init__.py
@@ -164,6 +204,8 @@ def build_extension(self, ext):
164204
cmd.append(f"-DVCPKG_INSTALLED_DIR={vcpkg_installed_dir}")
165205

166206
_log_and_run(*cmd, cwd="cpp")
207+
208+
cleanup_vcpkg_artifacts()
167209

168210
search = f"cpp/out/{preset}-build"
169211
candidates = glob.glob(search)

0 commit comments

Comments
 (0)