86 |
|
|
87 |
def transition_path(from_path, to_path): |
def transition_path(from_path, to_path): |
88 |
""" |
""" |
89 |
The current implementation sucks, so why wouldn't use |
Returns the transition path from from_path to to_path. |
|
something ready and working :) |
|
90 |
""" |
""" |
91 |
from_path = os.path.normpath(os.path.abspath(from_path)) |
|
92 |
to_path = os.path.normpath(os.path.abspath(to_path)) |
## Tried to use docutils.utils.relative_path instead of this, but |
93 |
|
## it crashed with Jython :( e.g. relative_path("", "") raised a |
94 |
|
## java.lang.NegativeArraySizeException |
95 |
|
|
96 |
# print "from:", from_path, "to:", to_path+"/foo" |
# print "from:", from_path, "to:", to_path+"/foo" |
97 |
# terrible kludge to avoid java.lang.NegativeArraySizeException with Jython |
# transition = docutils.utils.relative_path(from_path, to_path) |
|
transition = docutils.utils.relative_path(from_path+"/foo", to_path) |
|
|
if transition.startswith("../"): |
|
|
transition = transition[3:len(transition)] |
|
98 |
# print "transition:", transition |
# print "transition:", transition |
99 |
return transition |
# return transition |
100 |
|
|
101 |
""" |
|
102 |
Returns the transition path from from_path to to_path. |
from_path = os.path.normpath(os.path.abspath(from_path)) |
103 |
""" |
to_path = os.path.normpath(os.path.abspath(to_path)) |
104 |
depth = from_path.count("/") |
depth = from_path.count("/") |
105 |
from_parts = from_path.split("/") |
from_parts = from_path.split("/") |
106 |
to_parts = to_path.split("/") |
to_parts = to_path.split("/") |