summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2010-01-23 15:22:02 +0100
committerLuca Falavigna <dktrkranz@debian.org>2010-01-23 15:22:02 +0100
commit48f19e9e5ecc069f379ad433fdaf280ac9b54e16 (patch)
treeccb7df7851740465e630eeda7f618e66d1f86f53 /bin
parent72c578fd4b0b4a5a43e18594339ac4ff26c376dc (diff)
Imported Upstream version 1.2.0.d20100117upstream/1.2.0.d20100117
Diffstat (limited to 'bin')
-rw-r--r--bin/docdiff4
-rw-r--r--bin/docrun4
-rw-r--r--bin/docupdate4
-rw-r--r--bin/import-test.py4
-rw-r--r--bin/linecount.py4
-rw-r--r--bin/restore.sh26
-rw-r--r--bin/scons-doc.py (renamed from bin/sconsoutput.py)151
-rw-r--r--bin/scons_dev_master.py1
8 files changed, 120 insertions, 78 deletions
diff --git a/bin/docdiff b/bin/docdiff
index c565a04..c7adb05 100644
--- a/bin/docdiff
+++ b/bin/docdiff
@@ -4,13 +4,13 @@ if test $# -eq 0; then
for f in doc/user/*.in; do
xml=doc/user/`basename $f .in`.xml
echo $f:
- python bin/sconsoutput.py $f | diff $DIFFFLAGS $xml -
+ python bin/scons-doc.py $f | diff $DIFFFLAGS $xml -
done
else
for a in $*; do
f=doc/user/$a.in
xml=doc/user/$a.xml
echo $f:
- python bin/sconsoutput.py $f | diff $DIFFFLAGS $xml -
+ python bin/scons-doc.py $f | diff $DIFFFLAGS $xml -
done
fi
diff --git a/bin/docrun b/bin/docrun
index 5ba4215..ad8ea9f 100644
--- a/bin/docrun
+++ b/bin/docrun
@@ -4,13 +4,13 @@ if test $# -eq 0; then
for f in doc/user/*.in; do
xml=doc/user/`basename $f .in`.xml
echo $f:
- python bin/sconsoutput.py $f
+ python bin/scons-doc.py $f
done
else
for a in $*; do
f=doc/user/$a.in
xml=doc/user/$a.xml
echo $f:
- python bin/sconsoutput.py $f
+ python bin/scons-doc.py $f
done
fi
diff --git a/bin/docupdate b/bin/docupdate
index 0e1631b..cd9b532 100644
--- a/bin/docupdate
+++ b/bin/docupdate
@@ -4,13 +4,13 @@ if test $# -eq 0; then
for f in doc/user/*.in; do
xml=doc/user/`basename $f .in`.xml
echo $f:
- python bin/sconsoutput.py $f > $xml
+ python bin/scons-doc.py $f > $xml
done
else
for a in $*; do
f=doc/user/$a.in
xml=doc/user/$a.xml
echo $f:
- python bin/sconsoutput.py $f > $xml
+ python bin/scons-doc.py $f > $xml
done
fi
diff --git a/bin/import-test.py b/bin/import-test.py
index 473a7ed..e7d4db4 100644
--- a/bin/import-test.py
+++ b/bin/import-test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# tree2test.py - turn a directory tree into TestSCons code
#
@@ -25,7 +25,7 @@
# """ triple-quotes will need to have their contents edited by hand.
#
-__revision__ = "bin/import-test.py 4577 2009/12/27 19:44:43 scons"
+__revision__ = "bin/import-test.py 4629 2010/01/17 22:23:21 scons"
import os.path
import sys
diff --git a/bin/linecount.py b/bin/linecount.py
index 359f642..aa0a8aa 100644
--- a/bin/linecount.py
+++ b/bin/linecount.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Count statistics about SCons test and source files. This must be run
# against a fully-populated tree (for example, one that's been freshly
@@ -23,7 +23,7 @@
# interesting one for most purposes.
#
-__revision__ = "bin/linecount.py 4577 2009/12/27 19:44:43 scons"
+__revision__ = "bin/linecount.py 4629 2010/01/17 22:23:21 scons"
import os.path
import string
diff --git a/bin/restore.sh b/bin/restore.sh
index a5da9e8..0eec02f 100644
--- a/bin/restore.sh
+++ b/bin/restore.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
#
-# Simple hack script to restore __revision__, __COPYRIGHT_, 1.2.0.d20091224
+# Simple hack script to restore __revision__, __COPYRIGHT_, 1.2.0.d20100117
# and other similar variables to what gets checked in to source. This
# comes in handy when people send in diffs based on the released source.
#
@@ -22,9 +22,9 @@ header() {
for i in `find $DIRS -name '*.py'`; do
header $i
ed $i <<EOF
-g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation/p
+g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p
w
-/^__revision__ = /s/= .*/= "bin/restore.sh 4577 2009/12/27 19:44:43 scons"/p
+/^__revision__ = /s/= .*/= "bin/restore.sh 4629 2010/01/17 22:23:21 scons"/p
w
q
EOF
@@ -33,9 +33,9 @@ done
for i in `find $DIRS -name 'scons.bat'`; do
header $i
ed $i <<EOF
-g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation/p
+g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p
w
-/^@REM src\/script\/scons.bat/s/@REM .* knight/@REM bin/restore.sh 4577 2009/12/27 19:44:43 scons/p
+/^@REM src\/script\/scons.bat/s/@REM .* knight/@REM bin/restore.sh 4629 2010/01/17 22:23:21 scons/p
w
q
EOF
@@ -44,13 +44,13 @@ done
for i in `find $DIRS -name '__init__.py' -o -name 'scons.py' -o -name 'sconsign.py'`; do
header $i
ed $i <<EOF
-/^__version__ = /s/= .*/= "1.2.0.d20091224"/p
+/^__version__ = /s/= .*/= "1.2.0.d20100117"/p
w
-/^__build__ = /s/= .*/= "r4577[MODIFIED]"/p
+/^__build__ = /s/= .*/= "r4629"/p
w
/^__buildsys__ = /s/= .*/= "scons-dev"/p
w
-/^__date__ = /s/= .*/= "2009/12/27 19:44:43"/p
+/^__date__ = /s/= .*/= "2010/01/17 22:23:21"/p
w
/^__developer__ = /s/= .*/= "scons"/p
w
@@ -61,7 +61,7 @@ done
for i in `find $DIRS -name 'setup.py'`; do
header $i
ed $i <<EOF
-/^ *version = /s/= .*/= "1.2.0.d20091224",/p
+/^ *version = /s/= .*/= "1.2.0.d20100117",/p
w
q
EOF
@@ -70,11 +70,11 @@ done
for i in `find $DIRS -name '*.txt'`; do
header $i
ed $i <<EOF
-g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation/p
+g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p
w
-/# [^ ]* 0.96.[CD][0-9]* [0-9\/]* [0-9:]* knight$/s/.*/# bin/restore.sh 4577 2009/12/27 19:44:43 scons/p
+/# [^ ]* 0.96.[CD][0-9]* [0-9\/]* [0-9:]* knight$/s/.*/# bin/restore.sh 4629 2010/01/17 22:23:21 scons/p
w
-/Version [0-9][0-9]*\.[0-9][0-9]*/s//Version 1.2.0.d20091224/p
+/Version [0-9][0-9]*\.[0-9][0-9]*/s//Version 1.2.0.d20100117/p
w
q
EOF
@@ -83,7 +83,7 @@ done
for i in `find $DIRS -name '*.xml'`; do
header $i
ed $i <<EOF
-g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation/p
+g/Copyright (c) 2001.*SCons Foundation/s//Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation/p
w
q
EOF
diff --git a/bin/sconsoutput.py b/bin/scons-doc.py
index f99ec5a..e385b08 100644
--- a/bin/sconsoutput.py
+++ b/bin/scons-doc.py
@@ -1,7 +1,6 @@
-#!/usr/bin/env python2
-
+#!/usr/bin/env python
#
-# Copyright (c) 2003 Steven Knight
+# Copyright (c) 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,14 +20,11 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "/home/scons/sconsoutput/branch.0/baseline/src/sconsoutput.py 0.4.D001 2004/11/27 18:44:37 knight"
#
-# sconsoutput.py - an SGML preprocessor for capturing SCons output
-# and inserting it into examples in our DocBook
-# documentation
+# scons-doc.py - an SGML preprocessor for capturing SCons output
+# and inserting it into examples in our DocBook
+# documentation
#
# This script looks for some SGML tags that describe SCons example
# configurations and commands to execute in those configurations, and
@@ -93,8 +89,8 @@ __revision__ = "/home/scons/sconsoutput/branch.0/baseline/src/sconsoutput.py 0.4
# can see if there are any problems executing the command.
#
+import optparse
import os
-import os.path
import re
import sgmllib
import string
@@ -426,7 +422,12 @@ def command_scons(args, c, test, dict):
os.environ[key] = val
test.run(interpreter = sys.executable,
program = scons_py,
- arguments = '-f - ' + string.join(args),
+ # We use ToolSurrogates to capture win32 output by "building"
+ # examples using a fake win32 tool chain. Suppress the
+ # warnings that come from the new revamped VS support so
+ # we can build doc on (Linux) systems that don't have
+ # Visual C installed.
+ arguments = '--warn=no-visual-c-missing -f - ' + string.join(args),
chdir = test.workpath('WORK'),
stdin = Stdin % dict)
os.environ.update(save_vals)
@@ -489,11 +490,15 @@ def command_ls(args, c, test, dict):
else:
return ls(test.workpath('WORK'))
+def command_sleep(args, c, test, dict):
+ time.sleep(int(args[0]))
+
CommandDict = {
'scons' : command_scons,
'touch' : command_touch,
'edit' : command_edit,
'ls' : command_ls,
+ 'sleep' : command_sleep,
}
def ExecuteCommand(args, c, t, dict):
@@ -513,10 +518,11 @@ class MySGML(sgmllib.SGMLParser):
Note that this doesn't work with the 1.5.2 sgmllib module, because
that didn't have the ability to work with ENTITY declarations.
"""
- def __init__(self):
+ def __init__(self, outfp):
sgmllib.SGMLParser.__init__(self)
self.examples = {}
self.afunclist = []
+ self.outfp = outfp
# The first set of methods here essentially implement pass-through
# handling of most of the stuff in an SGML file. We're really
@@ -527,21 +533,21 @@ class MySGML(sgmllib.SGMLParser):
try:
f = self.afunclist[-1]
except IndexError:
- sys.stdout.write(data)
+ self.outfp.write(data)
else:
f(data)
def handle_comment(self, data):
- sys.stdout.write('<!--' + data + '-->')
+ self.outfp.write('<!--' + data + '-->')
def handle_decl(self, data):
- sys.stdout.write('<!' + data + '>')
+ self.outfp.write('<!' + data + '>')
def unknown_starttag(self, tag, attrs):
try:
f = self.example.afunc
except AttributeError:
- f = sys.stdout.write
+ f = self.outfp.write
if not attrs:
f('<' + tag + '>')
else:
@@ -551,13 +557,13 @@ class MySGML(sgmllib.SGMLParser):
f('>')
def unknown_endtag(self, tag):
- sys.stdout.write('</' + tag + '>')
+ self.outfp.write('</' + tag + '>')
def unknown_entityref(self, ref):
- sys.stdout.write('&' + ref + ';')
+ self.outfp.write('&' + ref + ';')
def unknown_charref(self, ref):
- sys.stdout.write('&#' + ref + ';')
+ self.outfp.write('&#' + ref + ';')
# Here is where the heavy lifting begins. The following methods
# handle the begin-end tags of our SCons examples.
@@ -581,7 +587,7 @@ class MySGML(sgmllib.SGMLParser):
e = self.e
files = filter(lambda f: f.printme, e.files)
if files:
- sys.stdout.write('<programlisting>')
+ self.outfp.write('<programlisting>')
for f in files:
if f.printme:
i = len(f.data) - 1
@@ -590,10 +596,10 @@ class MySGML(sgmllib.SGMLParser):
output = string.replace(f.data[:i+1], '__ROOT__', '')
output = string.replace(output, '<', '&lt;')
output = string.replace(output, '>', '&gt;')
- sys.stdout.write(output)
+ self.outfp.write(output)
if e.data and e.data[0] == '\n':
e.data = e.data[1:]
- sys.stdout.write(e.data + '</programlisting>')
+ self.outfp.write(e.data + '</programlisting>')
delattr(self, 'e')
self.afunclist = self.afunclist[:-1]
@@ -664,8 +670,8 @@ class MySGML(sgmllib.SGMLParser):
def end_scons_example_file(self):
f = self.f
- sys.stdout.write('<programlisting>')
- sys.stdout.write(f.data + '</programlisting>')
+ self.outfp.write('<programlisting>')
+ self.outfp.write(f.data + '</programlisting>')
delattr(self, 'f')
def start_scons_output(self, attrs):
@@ -731,13 +737,32 @@ class MySGML(sgmllib.SGMLParser):
while o.prefix[i-1] != '\n':
i = i - 1
- sys.stdout.write('<screen>' + o.prefix[:i])
+ self.outfp.write('<screen>' + o.prefix[:i])
p = o.prefix[i:]
+ # Regular expressions for making the doc output consistent,
+ # regardless of reported addresses or Python version.
+
+ # Massage addresses in object repr strings to a constant.
+ address_re = re.compile(r' at 0x[0-9a-fA-F]*\>')
+
+ # Massage file names in stack traces (sometimes reported as absolute
+ # paths) to a consistent relative path.
+ engine_re = re.compile(r' File ".*/src/engine/SCons/')
+
+ # Python 2.5 changed the stack trace when the module is read
+ # from standard input from read "... line 7, in ?" to
+ # "... line 7, in <module>".
+ file_re = re.compile(r'^( *File ".*", line \d+, in) \?$', re.M)
+
+ # Python 2.6 made UserList a new-style class, which changes the
+ # AttributeError message generated by our NodeList subclass.
+ nodelist_re = re.compile(r'(AttributeError:) NodeList instance (has no attribute \S+)')
+
for c in o.commandlist:
- sys.stdout.write(p + Prompt[o.os])
+ self.outfp.write(p + Prompt[o.os])
d = string.replace(c.data, '__ROOT__', '')
- sys.stdout.write('<userinput>' + d + '</userinput>\n')
+ self.outfp.write('<userinput>' + d + '</userinput>\n')
e = string.replace(c.data, '__ROOT__', t.workpath('ROOT'))
args = string.split(e)
@@ -748,14 +773,17 @@ class MySGML(sgmllib.SGMLParser):
elif lines:
content = string.join(lines, '\n' + p)
if content:
- content = re.sub(' at 0x[0-9a-fA-F]*\>', ' at 0x700000&gt;', content)
+ content = address_re.sub(r' at 0x700000&gt;', content)
+ content = engine_re.sub(r' File "bootstrap/src/engine/SCons/', content)
+ content = file_re.sub(r'\1 <module>', content)
+ content = nodelist_re.sub(r"\1 'NodeList' object \2", content)
content = string.replace(content, '<', '&lt;')
content = string.replace(content, '>', '&gt;')
- sys.stdout.write(p + content + '\n')
+ self.outfp.write(p + content + '\n')
if o.data[0] == '\n':
o.data = o.data[1:]
- sys.stdout.write(o.data + '</screen>')
+ self.outfp.write(o.data + '</screen>')
delattr(self, 'o')
self.afunclist = self.afunclist[:-1]
@@ -786,39 +814,52 @@ class MySGML(sgmllib.SGMLParser):
def end_sconstruct(self):
f = self.f
- sys.stdout.write('<programlisting>')
+ self.outfp.write('<programlisting>')
output = string.replace(f.data, '__ROOT__', '')
- sys.stdout.write(output + '</programlisting>')
+ self.outfp.write(output + '</programlisting>')
delattr(self, 'f')
self.afunclist = self.afunclist[:-1]
-# The main portion of the program itself, short and simple.
-try:
- file = sys.argv[1]
-except IndexError:
- file = '-'
+def process(filename):
+ if filename == '-':
+ f = sys.stdin
+ else:
+ try:
+ f = open(filename, 'r')
+ except EnvironmentError, e:
+ sys.stderr.write('%s: %s\n' % (filename, msg))
+ return 1
-if file == '-':
- f = sys.stdin
-else:
- try:
- f = open(file, 'r')
- except IOError, msg:
- print file, ":", msg
- sys.exit(1)
+ data = f.read()
+ if f is not sys.stdin:
+ f.close()
-data = f.read()
-if f is not sys.stdin:
- f.close()
+ if data.startswith('<?xml '):
+ first_line, data = data.split('\n', 1)
+ sys.stdout.write(first_line + '\n')
+
+ x = MySGML(sys.stdout)
+ for c in data:
+ x.feed(c)
+ x.close()
+
+ return 0
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ parser = optparse.OptionParser()
+ opts, args = parser.parse_args(argv[1:])
+
+ if not args:
+ args = ['-']
-if data.startswith('<?xml '):
- first_line, data = data.split('\n', 1)
- sys.stdout.write(first_line + '\n')
+ for arg in args:
+ process(arg)
-x = MySGML()
-for c in data:
- x.feed(c)
-x.close()
+if __name__ == "__main__":
+ sys.exit(main())
# Local Variables:
# tab-width:4
diff --git a/bin/scons_dev_master.py b/bin/scons_dev_master.py
index 5e8df41..4fa810d 100644
--- a/bin/scons_dev_master.py
+++ b/bin/scons_dev_master.py
@@ -79,6 +79,7 @@ TESTING_PACKAGES = [
'sun-java6-jdk',
'swig',
'texlive-base-bin',
+ 'texlive-extra-utils',
'texlive-latex-base',
'texlive-latex-extra',
'zip',