summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-02-01 01:18:03 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-02-01 01:18:03 +0000
commitf0bb6f81baa1b383e32fa895d8090665f4e4241c (patch)
treee72d2f2f821097c2b5a3c050f7ab9be82215a908 /bindings
parent741699ed0fff7607d4d6f4da1b8727bd08cf27dd (diff)
downloadlasso-f0bb6f81baa1b383e32fa895d8090665f4e4241c.tar.gz
lasso-f0bb6f81baa1b383e32fa895d8090665f4e4241c.tar.xz
lasso-f0bb6f81baa1b383e32fa895d8090665f4e4241c.zip
Bindings: os.path.relpath is only present since python 2.6, add a local implementation for older python versions
Diffstat (limited to 'bindings')
-rw-r--r--bindings/bindings.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bindings/bindings.py b/bindings/bindings.py
index a9b7f608..5337665b 100644
--- a/bindings/bindings.py
+++ b/bindings/bindings.py
@@ -42,6 +42,22 @@ except ImportError:
sys.path.append(os.path.dirname(__file__))
+# monkey patch os.path to include relpath if python version is < 2.6
+if not hasattr(os.path, "relpath"):
+ def relpath(longPath, basePath):
+ if not longPath.startswith(basePath):
+ raise RuntimeError("Unexpected arguments")
+ if longPath == basePath:
+ return "."
+ i = len(basePath)
+ if not basePath.endswith(os.path.sep):
+ i += len(os.path.sep)
+ return longPath[i:]
+
+ os.path.relpath = relpath
+
+
+
class BindingData:
src_dir = os.path.dirname(__file__)