[Python-modules-commits] [python-pyld] 249/276: pyld: relpath fix for Python 2.6

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:48:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-pyld.

commit 8678c4c6fcc654c90a43110d88d5c3964872929f
Author: Eric Peden <eric at ericpeden.com>
Date:   Fri Jul 12 16:29:43 2013 -0700

    pyld: relpath fix for Python 2.6
    
    * relpath('/foo', '/') returns '../foo' instead of just '/foo' on 2.6. This
      was causing the relative URL round-tripping test to fail.
    
    Reported-by: Yoan Blanc <yoan.blanc at cern.ch>
    Acked-by: Adrian-Tudor Panescu <adrian.tudor.panescu at cern.ch>
    
    Conflicts:
    	lib/pyld/jsonld.py
---
 lib/pyld/jsonld.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 41003e2..2e63401 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -482,6 +482,9 @@ def remove_base(base, iri):
 
     path = posixpath.relpath(rel.path, base.path) if rel.path else ''
     path = posixpath.normpath(path)
+    # workaround a relpath bug in Python 2.6 (http://bugs.python.org/issue5117)
+    if base.path == "/" and path.startswith("../"):
+        path = path[3:]
     if path == '.' and not rel.path.endswith('/') and not (
             rel.query or rel.fragment):
         path = posixpath.basename(rel.path)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list