source: anuga_core/documentation/user_manual/update_anuga_user_manual.py @ 3934

Last change on this file since 3934 was 3934, checked in by ole, 17 years ago

Small fixes

  • Property svn:executable set to *
File size: 1.7 KB
RevLine 
[2733]1#!/usr/bin/env python
2
[2736]3"""Update, compile and create PDF and HTML from LaTeX file
4
[3921]5Usage:
6    python update_anuga_user_manual.py <options>
7   
8Options:
9    --no_html: Skip automatic generation of html version
10   
[2736]11
[3921]12
13This script can for example be run from a cronjob:
14
[2736]15  crontab -e
16
17with content
18
19SHELL=/bin/sh
20PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:~/bin
21
22# m h dom mon dow command
23  42 *  *   *   *  ~/anuga/documentation/user_manual/update_anuga_user_manual.py > ~/anuga/documentation/user_manual/update_anuga.log
24#
25
26
27Note UNIX only
28 
29"""
30
[3921]31from os import system, chdir
32from os.path import expanduser
[2736]33
[3921]34from sys import argv
[2733]35
36
[3921]37anugapath = expanduser('~/inundation/anuga_core/documentation/user_manual')
[3107]38texfiles = ['anuga_user_manual', 'anuga_installation_guide']
[2733]39
[3921]40chdir(anugapath) # Move to location of LaTeX files
41system('svn update') # Update from svn
[2733]42
43
[3921]44do_html = True       
45if len(argv) > 1:
46    if argv[1] == '--no_html':
47        do_html = False
48    else:
49        msg = 'Unknown option: %s' %argv[1]
50        raise Exception(msg)
51   
[3107]52for texfile in texfiles:
53    print 'Processing %s' %texfile
54    # Compile with LaTeX, makeindex etc
55    for i in range(3):
[3934]56        #system('latex --interaction=nonstopmode %s.tex' %texfile)
57        system('pdflatex --interaction=nonstopmode %s.tex' %texfile)
58        system('makeindex %s.idx' %texfile)
59        system('makeindex mod%s.idx' %texfile)
60        system('bibtex %s' %texfile)   
[3107]61
62    # Create pdf file
[3934]63    #system('dvips %s -o %s.ps' %((texfile,)*2))   
64    #system('ps2pdf %s.ps' %texfile)   
[2733]65     
[3921]66    # Create html pages
67    if do_html is True:
68        system('latex2html %s' %texfile)
69    else:
70        print 'Skipping html version for %s as requested' %texfile
[2733]71
Note: See TracBrowser for help on using the repository browser.