Skip to content

Commit 0170030

Browse files
authored
Properly add challenge.yml for templates into the poetry built package (#139)
* Have poetry run a preprocess script which replaces the challenge.yml symlinks with the actual file contents
1 parent 12eb664 commit 0170030

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

preprocess.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import os
2+
3+
4+
def replace_symlinks():
5+
os.system("""find . -type l -exec sh -c 'target=$(readlink -f "$0"); rm "$0" && cp "$target" "$0"' {} \;""")
6+
7+
8+
if __name__ == "__main__":
9+
replace_symlinks()

pyproject.toml

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ readme = "README.md"
88
[tool.poetry.scripts]
99
ctf = "ctfcli.__main__:main"
1010

11+
[tool.poetry.build]
12+
# I don't understand why poetry doesn't seem to be following symlinks.
13+
# This script resolves the symlinks in the templates to the example challenge spec
14+
script = "preprocess.py"
15+
1116
[tool.poetry.dependencies]
1217
python = "^3.8"
1318
python-frontmatter = "^1.0.0"

0 commit comments

Comments
 (0)