File: repatch

package info (click to toggle)
doclifter 2.21-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,888 kB
  • sloc: python: 10,117; xml: 2,384; sh: 274; makefile: 79; lisp: 37
file content (19 lines) | stat: -rwxr-xr-x 720 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
# Redo a patch that applied successfully but with an offset
# Give this a page and section as argument, e.g. "as.1".
import os, sys

page = sys.argv[1]
patch = page + ".patch"
fields = page.split(".")
stem = ".".join(fields[:-1])
section = fields[-1]
os.system("manlifter -s %s %s" % (section, stem))
os.rename("foobar.man", page + "-patched")	# Save the patched version
os.rename("prepatch/" + patch, patch + "-old") 
os.system("manlifter -s %s %s" % (section, stem))
os.rename("foobar.man", page + "-unpatched")	# Save the unpatched version
os.rename(page + "-patched", page)
os.system("diff -u %s-unpatched %s >prepatch/%s" % (page, page, patch))
os.remove(page + "-unpatched")
os.remove(page)