New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
PDF_creation.sh in NEMO/branches/2019/fix_ticket2293/doc – NEMO

source: NEMO/branches/2019/fix_ticket2293/doc/PDF_creation.sh @ 11838

Last change on this file since 11838 was 10474, checked in by mathiot, 5 years ago

Add python module check before compiling the documentation (pygments module is needed by some latex package)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1007 bytes
Line 
1#!/bin/sh
2
3export opts='-shell-escape -pdf'
4model='NEMO'
5
6check_python_module() {
7    python -c "
8import sys
9try:
10    import $1
11    print('\nModule $1 is installed')
12except ImportError:
13    print('\nModule $1 is NOT installed')
14    print('')
15    sys.exit(42)"
16}
17
18clean() {
19    ## Delete latex build files
20    find latex -regextype posix-extended                                              \
21         -regex ".*\.(aux|bbl|blg|dvi|fdb|fls|idx|ilg|ind|log|maf|mtc|out|pdf|toc).*" \
22         -exec rm {} \;
23
24    ## Remove 'minted' directories
25    find latex -type d -name '_minted*' -exec rm -r {} \;
26
27    ## HTML exports
28    find latex -type d -name 'html*'    -exec rm -r {} \;
29}
30
31build() {
32    cd latex/$1/main
33    latexmk $opts $1'_manual' > /dev/null
34    mv            $1'_manual'.pdf ../../..
35    cd -
36}
37
38check_python_module pygments
39if [ $? -ne 0 ]; then echo 'Required python module pygments to correctly build the documentation is missing; exit 42'; echo ''; exit 42; fi
40
41clean
42
43build $model
44
45exit 0
Note: See TracBrowser for help on using the repository browser.