Mercurial > hg > kdocs
view make/fixlinks.py @ 51:93c68f362860
New script to download OLS files (and others), and split up volumes into
individual papers, plus teach make.sh to run it.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 28 Sep 2007 14:47:14 -0500 |
parents | 31787234d021 |
children | ecfa70db0bb3 |
line wrap: on
line source
#!/usr/bin/python # Convert the absolute paths in the symlinks of manlifter's html translation # of the man-pages into portable relative paths. import os, sys for i in sys.argv[1:]: srcname = i.split("/") linkname = os.readlink(i).split("/")[1:] if srcname[1] == linkname[0] or srcname[1] == linkname [0][:-1]: linkname = linkname[1:] else: linkname = [".."] + linkname srcname = "/".join(srcname) linkname = "/".join(linkname) os.unlink(srcname) os.symlink(linkname, srcname)