From: Michael Tremer Date: Tue, 11 Feb 2025 13:30:48 +0000 (+0000) Subject: backend: Add helper function to make paths relative X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=944de041a224813dbb223cfd1b2bd0fdb298c069;p=pbs.git backend: Add helper function to make paths relative Signed-off-by: Michael Tremer --- 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=*")