Changeset 11004


Ignore:
Timestamp:
2019-05-20T16:51:02+02:00 (18 months ago)
Author:
nicolasmartin
Message:

Review of main building script

  • Exportig Python package checking to external script check_pkg.py for sharing it with the verification of deps for the user guide (sphinx, extension and theme)
  • Renaming to explicit manual_build.sh
  • Addition of basic checking for LaTeX installation (latexmk binary)
  • Implementation of loop and argument reading in order to use the same script for the 3 manuals
  • Improvment of code commentary
Location:
NEMO/trunk/doc
Files:
3 added
1 deleted
3 copied
2 moved

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/doc/manual_build.sh

    r10997 r11004  
    11#!/bin/sh 
    22 
    3 export opts='-shell-escape -pdf -quiet' 
    4 model='NEMO' 
     3## Initialisation 
     4##--------------- 
    55 
    6 check_python_module() { 
    7     python -c " 
    8 import sys 
    9 try: 
    10     import $1 
    11     print('\nModule $1 is installed') 
    12 except ImportError: 
    13     print('\nModule $1 is NOT installed') 
    14     print('') 
    15     sys.exit(42)" 
    16 } 
     6## latekmk options 
     7opts='-shell-escape -quiet' 
    178 
    18 clean() { 
    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 {} \; 
     9## Default selection for models 
     10if   [ "$1" = 'all' ]; then 
     11   models='NEMO SI3 TOP' 
     12elif [ "$1" =    '' ]; then 
     13   models='NEMO' 
     14else 
     15   models=$* 
     16fi 
    2317 
    24     ## Remove 'minted' directories 
    25     find latex -type d -name '_minted*' -exec rm -r {} \; 
     18## Avoid the use of shell builtin echo (for -e option) 
     19alias echo='/bin/echo -e' 
    2620 
    27     ## HTML exports 
    28     find latex -type d -name 'html*'    -exec rm -r {} \; 
    29 } 
     21# Source shared functions 
     22. tools/shr_func.sh 
    3023 
    31 build() { 
    32     cd latex/$1/main 
    33     latexmk $opts $1'_manual' > /dev/null 
    34     mv            $1'_manual'.pdf ../../.. 
    35     cd - 
    36 } 
    3724 
    38 check_python_module pygments 
    39 if [ $? -ne 0 ]; then echo 'Required python module pygments to correctly build the documentation is missing; exit 42'; echo ''; exit 42; fi 
     25## Check dependancies 
     26##------------------- 
    4027 
    41 clean 
     28## LaTeX installation, find latexmk should be enough 
     29[ -z $( which latexmk ) ] && { echo 'latexmk binary is not present => QUIT'; exit 2; } 
    4230 
    43 [ ! -d figures ] && svn co http://forge.ipsl.jussieu.fr/nemo/svn/utils/figures 
     31## Retrieve figures if not already there 
     32if [ ! -d latex/figures ]; then 
     33   echo "Downloading of shared figures and logos\n" 
     34   svn co https://forge.ipsl.jussieu.fr/nemo/svn/utils/figures latex/figures > /dev/null 
     35fi 
    4436 
    45 build $model 
     37## Pygments package for syntax highlighting of source code (namelists & snippets) 
     38[ -n "$( ./tools/check_pkg.py pygments )" ] && { exit 2; } 
     39 
     40 
     41## Loop on the models 
     42##------------------- 
     43 
     44for model in $models; do 
     45   echo $model"\n" 
     46   clean $model; build $model 
     47   echo "\t"'¤ End of build run' 
     48   echo "\t\t"'The export should be available at root' 
     49   echo "\t\t"'If not check LaTeX log in ./latex/'$model'/main/'$model'_manual.log'"\n" 
     50done 
    4651 
    4752exit 0 
  • NEMO/trunk/doc/tools/nlsts_update.sh

    r10990 r11004  
    104104    ;; 
    105105    *) 
    106         set -o posix 
     106        #set -o posix 
    107107    ;; 
    108108esac 
Note: See TracChangeset for help on using the changeset viewer.