annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/usr/bin/python
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
2
18
31787234d021 Add a script to convert 00-INDEX files to index.html, and add comments.
Rob Landley <rob@landley.net>
parents: 17
diff changeset
3 # Convert the absolute paths in the symlinks of manlifter's html translation
31787234d021 Add a script to convert 00-INDEX files to index.html, and add comments.
Rob Landley <rob@landley.net>
parents: 17
diff changeset
4 # of the man-pages into portable relative paths.
31787234d021 Add a script to convert 00-INDEX files to index.html, and add comments.
Rob Landley <rob@landley.net>
parents: 17
diff changeset
5
17
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
6 import os, sys
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
7
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
8 for i in sys.argv[1:]:
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
9 srcname = i.split("/")
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
10 linkname = os.readlink(i).split("/")[1:]
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
11 if srcname[1] == linkname[0] or srcname[1] == linkname [0][:-1]:
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
12 linkname = linkname[1:]
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
13 else:
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
14 linkname = [".."] + linkname
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
15 srcname = "/".join(srcname)
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
16 linkname = "/".join(linkname)
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
17 os.unlink(srcname)
6b8d10c36bff Use the doclifter mercurial repository (until the next release, anyway)
Rob Landley <rob@landley.net>
parents:
diff changeset
18 os.symlink(linkname, srcname)