src/modules/misc.py
changeset 2112 5e0694e53b38
parent 2097 068cc63b4d6e
child 2126 7f6719cd083b
child 2359 3949372f7b93
child 2522 8cb391c2269d
--- a/src/modules/misc.py	Mon Oct 18 11:39:02 2010 -0700
+++ b/src/modules/misc.py	Tue Oct 19 12:55:46 2010 -0700
@@ -834,3 +834,11 @@
 PKG_DIR_MODE = (stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH |
     stat.S_IXOTH)
 PKG_RO_FILE_MODE = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
+
+def relpath(path, start="."):
+        """Version of relpath to workaround python bug:
+            http://bugs.python.org/issue5117
+        """
+        if path and start and start == "/" and path[0] == "/":
+                return path.lstrip("/")
+        return os.path.relpath(path, start=start)