4 from __future__ import absolute_import, division
10 MAN_NAME_RE = re.compile(r'/man/(?:[^/]+/)?man([^/]+)/[^/]+.\1$')
12 SO_RE = re.compile(r'^\.so\s+(.*)$')
14 def process_file(name):
15 m = MAN_NAME_RE.search(name)
19 dir_name = 'man' + category
31 if link.startswith('/') or link.count('/') > 1:
33 if link.startswith(dir_name+'/'):
34 link = link[len(dir_name)+1:]
38 os.symlink(link, name)
39 print 'Converted {} into a symlink to {}'.format(name, link)
44 dashes = args.index('--')
49 compressor = args[:dashes]
50 all_files = args[dashes+1:]
52 for name in all_files:
53 if not process_file(name):
55 if not compressor or not files:
57 os.execvp(compressor[0], compressor + files)
60 if __name__ == '__main__':
61 sys.exit(main(sys.argv[1:]))