From 5af071b7bb313142fe15773ad0fee05f859c0c7e Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Sun, 3 Dec 2023 14:20:58 -0500 Subject: [PATCH] Have poetry run a preprocess script which replaces the challenge.yml symlinks with the actual file contents --- preprocess.py | 7 +++++++ pyproject.toml | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 preprocess.py diff --git a/preprocess.py b/preprocess.py new file mode 100644 index 0000000..84acebf --- /dev/null +++ b/preprocess.py @@ -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() diff --git a/pyproject.toml b/pyproject.toml index 25ae0a6..82a0d25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"