[rtems-central commit] items: Use commonpath() instead of commonprefix()

Sebastian Huber sebh at rtems.org
Fri Sep 18 11:31:55 UTC 2020


Module:    rtems-central
Branch:    master
Commit:    e3563c1d0d1137d1397463fedeb754db61067677
Changeset: http://git.rtems.org/rtems-central/commit/?id=e3563c1d0d1137d1397463fedeb754db61067677

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 24 14:09:48 2020 +0200

items: Use commonpath() instead of commonprefix()

This ensures that we get a valid path.

---

 rtemsspec/items.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 4da02dd..2f4d80a 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -455,7 +455,7 @@ class ItemCache:
     def _load_items_recursive(self, base: str, path: str,
                               cache_dir: str) -> None:
         mid = os.path.abspath(path)
-        mid = mid.replace(os.path.commonprefix([cache_dir, mid]), "")
+        mid = mid.replace(os.path.commonpath([cache_dir, mid]), "").strip("/")
         cache_file = os.path.join(cache_dir, mid, "spec.pickle")
         try:
             mtime = os.path.getmtime(cache_file)



More information about the vc mailing list