From 734afd892bb372ff8b0b0777c8622806074270c5 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Sun, 11 Sep 2016 23:05:36 +0200 Subject: [PATCH] common.tools: Add a function for relative pathes rel_path(a, b) is the absolute path of b, taken relative to a. If b is already an absolute path, rel_path(a, b) is b. --- bootstrapvz/common/tools.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bootstrapvz/common/tools.py b/bootstrapvz/common/tools.py index ada2909..0fceb93 100644 --- a/bootstrapvz/common/tools.py +++ b/bootstrapvz/common/tools.py @@ -133,3 +133,8 @@ def copy_tree(from_path, to_path): for path in files: copy(os.path.join(abs_prefix, path), os.path.join(to_path, prefix, path)) + + +def rel_path(base, path): + import os.path + return os.path.join(os.path.dirname(base), path)