fix mistake in RELEASE.txt content
[scons.git] / bin / restore.sh
blob0ed181df6c4b28713fb32a5341886c3d438e271f
1 #!/usr/bin/env sh
3 # Simple hack script to restore __revision__, __COPYRIGHT_, __VERSION__
4 # and other similar variables to what gets checked in to source. This
5 # comes in handy when people send in diffs based on the released source.
8 if test "X$*" = "X"; then
9 DIRS="src test"
10 else
11 DIRS="$*"
14 SEPARATOR="================================================================================"
16 header() {
17 arg_space="$1 "
18 dots=`echo "$arg_space" | sed 's/./\./g'`
19 echo "$SEPARATOR" | sed "s;$dots;$arg_space;"
22 for i in `find $DIRS -name '*.py'`; do
23 header $i
24 ed $i <<EOF
25 g/Copyright (c) 2001.*SCons Foundation/s//__COPYRIGHT__/p
27 /^__revision__ = /s/= .*/= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"/p
30 EOF
31 done
33 for i in `find $DIRS -name 'scons.bat'`; do
34 header $i
35 ed $i <<EOF
36 g/Copyright (c) 2001.*SCons Foundation/s//__COPYRIGHT__/p
38 /^@REM src\/script\/scons.bat/s/@REM .* knight/@REM __FILE__ __REVISION__ __DATE__ __DEVELOPER__/p
41 EOF
42 done
44 for i in `find $DIRS -name '__init__.py' -o -name 'scons.py' -o -name 'sconsign.py'`; do
45 header $i
46 ed $i <<EOF
47 /^__version__ = /s/= .*/= "__VERSION__"/p
49 /^__build__ = /s/= .*/= "__BUILD__"/p
51 /^__buildsys__ = /s/= .*/= "__BUILDSYS__"/p
53 /^__date__ = /s/= .*/= "__DATE__"/p
55 /^__developer__ = /s/= .*/= "__DEVELOPER__"/p
58 EOF
59 done
61 for i in `find $DIRS -name 'setup.py'`; do
62 header $i
63 ed $i <<EOF
64 /^ *version = /s/= .*/= "__VERSION__",/p
67 EOF
68 done
70 for i in `find $DIRS -name '*.txt'`; do
71 header $i
72 ed $i <<EOF
73 g/Copyright (c) 2001.*SCons Foundation/s//__COPYRIGHT__/p
75 /# [^ ]* 0.96.[CD][0-9]* [0-9\/]* [0-9:]* knight$/s/.*/# __FILE__ __REVISION__ __DATE__ __DEVELOPER__/p
77 /Version [0-9][0-9]*\.[0-9][0-9]*/s//Version __VERSION__/p
80 EOF
81 done
83 for i in `find $DIRS -name '*.xml'`; do
84 header $i
85 ed $i <<EOF
86 g/Copyright (c) 2001.*SCons Foundation/s//__COPYRIGHT__/p
89 EOF
90 done