4 # This script is installed as a cron job to automatically update the
5 # Docutils web site whenever the CVS files change. Any .html document
6 # with a corresponding .txt file is regenerated whenever the .txt
10 # -e Access CVS as current user ("ext" instead of "pserver"; requires
12 # -p Run from the project directory.
13 # -t Run the script in trace mode ("set -o xtrace").
14 # -u Regenerate .html unconditionally.
20 # make all newly created files group writeable
23 projdir
=/home
/groups
/d
/do
/docutils
26 snapshotdir
=$projdir/snapshots
27 pylib
=$projdir/lib
/python
32 export CVSROOT
=:pserver
:anonymous@cvs1
:/cvsroot
/$project
38 while getopts eptuv opt
41 e
) root
="-d:ext:${USER}@cvs1:/cvsroot/docutils" ;;
42 p
) export PYTHONPATH
=$pylib:$lib:$lib/extras
;;
49 shift `expr $OPTIND - 1`
51 if [ $trace -eq 1 -o $verbose -eq 1 ] ; then
57 cvs
-Q -z3 $root update
2>&1 > /dev
/null
59 # gather the materials
61 cvs
-Q -z3 $root update
-rHEAD $project sandbox web
63 # ensure proper permissions are set
64 find .
-type f
-print0 |
xargs -0 chmod ug
+rw
2> /dev
/null || true
65 find .
-type d
-print0 |
xargs -0 chmod ug
+rwxs
2> /dev
/null || true
67 # ensure executable bits are set
68 chmod +x
$project/*.py
2> /dev
/null || true
69 chmod +x
$project/tools
/*.py
2> /dev
/null || true
70 chmod +x
$project/test
/alltests.py
2> /dev
/null || true
71 find $project/test -name 'test_*.py' -print0 |
xargs -0 chmod +x
2> /dev
/null || true
73 # create the snapshots
74 exclude
='--exclude=CVS --exclude=.cvsignore'
75 tar -cz $exclude -f $project-snapshot.tgz
$project
76 tar -cz $exclude -f $project-sandbox-snapshot.tgz sandbox
77 tar -cz $exclude -f $project-web-snapshot.tgz web
78 ( cd sandbox
/gschwant
;
79 tar -cz $exclude -f ..
/..
/docfactory-snapshot.tgz docfactory
)
82 mv -f *snapshot.tgz
$dest
85 cp -ruf $project/* $dest
87 cp -ruf web
/* web
/.
[^.
]* $dest
91 find -name CVS
-type d
-exec rm -rf {} \
; -prune
92 find -name .cvsignore
-type f
-exec rm -f {} \
; -prune
94 # ensure proper permissions are set
96 find .
-type f
-print0 |
xargs -0 chmod ug
+rw
2> /dev
/null || true
97 find .
-type d
-print0 |
xargs -0 chmod ug
+rwxs
2> /dev
/null || true
102 if [ $trace -eq 0 ] ; then
106 for htmlfile
in `find .. -name '*.html'` ; do
107 dir
=`dirname $htmlfile`
108 base
=`basename $htmlfile .html`
109 txtfile
=$dir/$base.txt
110 if [ -e $txtfile ] ; then
111 if [ $unconditional -eq 1 -o $txtfile -nt $htmlfile ] ; then
112 if [ "${base:0:4}" == "pep-" ] ; then
113 echo "$txtfile (PEP)"
114 # pep2html.py fails on SourceForge; can't import cgi
115 # (cgi imports urllib which imports socket which imports
116 # _socket; libssl.so.2 doesn't exist on SF):
117 ~
/bin
/python
$lib/tools
/pep.py
--config=$dir/docutils.conf
$txtfile $htmlfile
120 ~
/bin
/python
$lib/tools
/rst2html.py
--config=$dir/docutils.conf
$txtfile $htmlfile
127 # indent-tabs-mode: nil