]> git.donarmstrong.com Git - lilypond.git/blob - scripts/build/relative.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / build / relative.py
1 #! @PYTHON@
2
3 import os
4 import sys
5
6 def relative (dir, r=os.getcwd ()):
7     dir = os.path.normpath (dir) + '/'
8     r = os.path.normpath (r) + '/'
9     prefix = len (os.path.commonprefix ((dir, r)))
10     if prefix == len (dir):
11         return './'
12     if prefix > 1:
13         return '../' * (len (r[prefix:].split ('/')) - 1) + dir[prefix:]
14     return dir
15
16 if __name__ == '__main__':
17     print relative (sys.argv[1])