Skip to content

Commit

Permalink
Recreate Boost symlink at runtime to survive sdist. Closes: #13763.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Oct 11, 2024
1 parent 4d16230 commit adeb844
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
5 changes: 4 additions & 1 deletion run_format_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ def check_format() -> None:
check_file(root / file)

def check_symlinks():
# Test data must NOT contain symlinks. setup.py
# butchers them. If you need symlinks, they need
# to be created on the fly.
for f in Path('test cases').glob('**/*'):
if f.is_symlink():
if 'boost symlinks' in str(f):
if 'boost symlinks/boost/lib' in str(f):
continue
raise SystemExit(f'Test data dir contains symlink: {f}.')

Expand Down
24 changes: 18 additions & 6 deletions run_project_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,12 +1563,17 @@ def get_version(t: ToolInfo) -> str:
print('{0:<{2}}: {1}'.format(tool.tool, get_version(tool), max_width))
print()

tmpdir = list(Path('.').glob('test cases/**/*install functions and follow symlinks'))
assert len(tmpdir) == 1
symlink_test_dir = tmpdir[0]
symlink_file1 = symlink_test_dir / 'foo/link1'
symlink_file2 = symlink_test_dir / 'foo/link2.h'
del tmpdir
tmpdir1 = list(Path('.').glob('test cases/**/*install functions and follow symlinks'))
tmpdir2 = list(Path('.').glob('test cases/frameworks/*boost symlinks'))
assert len(tmpdir1) == 1
assert len(tmpdir2) == 1
symlink_test_dir1 = tmpdir1[0]
symlink_test_dir2 = tmpdir2[0] / 'boost/include'
symlink_file1 = symlink_test_dir1 / 'foo/link1'
symlink_file2 = symlink_test_dir1 / 'foo/link2.h'
symlink_file3 = symlink_test_dir2 / 'boost'
del tmpdir1
del tmpdir2

def clear_transitive_files() -> None:
a = Path('test cases/common')
Expand All @@ -1585,11 +1590,18 @@ def clear_transitive_files() -> None:
symlink_file2.unlink()
except FileNotFoundError:
pass
try:
symlink_file3.unlink()
symlink_test_dir2.rmdir()
except FileNotFoundError:
pass

def setup_symlinks() -> None:
try:
symlink_file1.symlink_to('file1')
symlink_file2.symlink_to('file1')
symlink_test_dir2.mkdir(parents=True, exist_ok=True)
symlink_file3.symlink_to('../Cellar/boost/0.3.0/include/boost')
except OSError:
print('symlinks are not supported on this system')

Expand Down

This file was deleted.

6 changes: 6 additions & 0 deletions test cases/frameworks/35 boost symlinks/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
project('boosttestsymlinks', 'cpp')

bm = build_machine.system()

if bm == 'windows' or bm == 'cygwin'
error('MESON_SKIP_TEST: Windows and symlinks do not mix.')
endif

dep = dependency('boost', modules : ['regex', 'python'], required: false)

assert(dep.found(), 'expected to find a fake version of boost')
Expand Down
3 changes: 3 additions & 0 deletions test cases/frameworks/35 boost symlinks/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"expect_skip_on_jobname": ["azure", "cygwin", "msys2"]
}

0 comments on commit adeb844

Please sign in to comment.