From 214f6aa6553ecdfa11d2ec63bb1cef1a49e8538d Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 31 Oct 2021 23:35:35 +0100 Subject: Add simplified concerts syntax --- helpers.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 helpers.py (limited to 'helpers.py') diff --git a/helpers.py b/helpers.py new file mode 100644 index 0000000..faf14e7 --- /dev/null +++ b/helpers.py @@ -0,0 +1,9 @@ +from os import path +from pathlib import Path + + +def relative_path(*, to, ref): + # pathlib.Path(x).relative_to(y) cannot handle y not being under x, + # os.path.dirname('x') yields '' rather than '.'. + # 😮‍💨 + return path.relpath(to, Path(ref).parent) -- cgit v1.2.3