Fix #338: re.sub() flag argument at wrong position.
[docutils.git] / sandbox / infrastructure / release-test.sh
bloba28516614bc9be37907e142877335839660bd739
1 #!/bin/bash
3 # testing of a release tarball extracted from release.sh
4 # because if this breaks release.sh exits
5 # and running tests again 2.4 to 2.7 automatic never worked for me
6 # and 3.x is not included
8 # Author: Lea Wiemann
9 # Contact: grubert@users.sourceforge.net
10 # Revision: $Revision: 7548 $
11 # Date: $Date: 2012-12-13 10:08:17 +0100 (Don, 13 Dez 2012) $
12 # Copyright: This script has been placed in the public domain.
14 USAGE="USAGE $0 python-version docutils-version"
16 py_ver=$1
18 docutils_ver=$2
20 if [ -z "`which python$py_ver`" ] ; then
21 echo "ERROR python$py_ver not found."
22 echo $USAGE
23 exit 1
26 tarball=docutils-${docutils_ver}.tar.gz
28 if [ ! -e $tarball ] ; then
29 echo "ERROR $tarball not found."
30 echo $USAGE
31 exit 1
34 function print_command()
36 # Print "$@", quoting parameters containing spaces.
37 echo -n $
38 for param in "$@"; do
39 echo "$param" | grep -Fq ' ' && echo -n " '$param'" || echo -n " $param"
40 done
43 function run()
45 # Print and run "$@".
46 print_command "$@"
47 echo
48 "$@"
51 echo "Testing the release tarball: docutils-${docutils_ver} under python$py_ver."
53 echo "ATTENTION: some parts must be run as root/sudo to be able to remove/install into site-packages."
55 START_DIR=`pwd`
57 test_dir=tarball_test
58 run rm -rf $test_dir
59 run mkdir -p $test_dir
60 cd $test_dir
62 py_ver_maj=${py_ver:0:1}
63 echo "Deleting and installing Docutils on Python $py_ver ($py_ver_maj)."
64 echo "Press enter."
65 read
67 if [ $py_ver_maj = "2" ] ; then
68 docutils_install_dir=$(python$py_ver -c 'import docutils, os.path; print os.path.dirname(docutils.__file__)')
69 else
70 docutils_install_dir=$(python$py_ver -c 'import docutils, os.path; print(os.path.dirname(docutils.__file__))')
73 if [ -z "$docutils_install_dir" ] ; then
74 echo "No docutils installation found"
75 else
76 echo "docutils installation found: $docutils_install_dir"
77 echo "remove docutils installation (sudo). Ctrl-C to abort"
78 read
79 sudo rm -rfv $docutils_install_dir
82 echo "build and install (sudo). Ctrl-C to abort"
83 read
84 run tar xzf ../$tarball
86 cd docutils-"$docutils_ver"
88 python$py_ver setup.py build
89 sudo python$py_ver setup.py install
90 echo
91 echo "Remove __init__.py from docutils code directory to make sure it is not used.."
92 read
93 rm -rf docutils/__init__.py
95 # BUG test-dependecies.py
96 # * breaks on record.txt access if not run as root
97 # * fails missing dependencies to files in docutils/docs.
99 echo "run alltests.py"
101 if [ ${py_ver_maj} = "2" ] ; then
102 TESTD=test
103 else
104 TESTD=test3
107 python$py_ver -u ${TESTD}/alltests.py
109 echo "remove test directory Ctrl C to abort"
110 read
111 cd $START_DIR
112 rm -rfv $test_dir