Skip to content

Commit

Permalink
Have poetry run a preprocess script which replaces the challenge.yml …
Browse files Browse the repository at this point in the history
…symlinks with the actual file contents
  • Loading branch information
ColdHeat committed Dec 3, 2023
1 parent 12eb664 commit 5af071b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions preprocess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

def replace_symlinks():
os.system("""find . -type l -exec sh -c 'target=$(readlink -f "$0"); rm "$0" && cp "$target" "$0"' {} \;""")

if __name__ == "__main__":
replace_symlinks()
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ readme = "README.md"
[tool.poetry.scripts]
ctf = "ctfcli.__main__:main"

[tool.poetry.build]
# I don't understand why poetry doesn't seem to be following symlinks.
# This script resolves the symlinks in the templates to the example challenge spec
script = "preprocess.py"

[tool.poetry.dependencies]
python = "^3.8"
python-frontmatter = "^1.0.0"
Expand Down

0 comments on commit 5af071b

Please sign in to comment.