From 944de041a224813dbb223cfd1b2bd0fdb298c069 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 11 Feb 2025 13:30:48 +0000 Subject: [PATCH] backend: Add helper function to make paths relative Signed-off-by: Michael Tremer --- src/buildservice/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/buildservice/__init__.py b/src/buildservice/__init__.py index f878b7a8..3bb62632 100644 --- a/src/buildservice/__init__.py +++ b/src/buildservice/__init__.py @@ -160,6 +160,12 @@ class Backend(object): """ return os.path.join(self.basepath, *args) + def relpath(self, path): + """ + Does the reverse of path() + """ + return os.path.relpath(path, self.basepath) + def url_to(self, url): """ Takes a relative URL and makes it absolute @@ -595,10 +601,7 @@ class Backend(object): # Add all paths for path in paths: - # Make the path relative (again) - path = os.path.relpath(path, self.basepath) - - commandline.append("--include=%s***" % path) + commandline.append("--include=%s***" % self.relpath(path)) # Exclude everything that hasn't been included commandline += ("--include=*/", "--exclude=*") -- 2.47.2