diff --git a/preprocess.py b/preprocess.py new file mode 100644 index 0000000..8085055 --- /dev/null +++ b/preprocess.py @@ -0,0 +1,9 @@ +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"