download.php: new version number
+ includes/templates.php:
+ update $latestrelease
+
includes/versions.php:
update $stablerelease and/or $latestrelease
- add new version number do $docversions[],
- SHIFT $docversions[] INDEX NUMBERS :-(
+ add new version number to $docversions[],
+ IMPORTANT: SHIFT $docversions[] INDEX NUMBERS :-(
index.php: announcement on the home page
remove out-of-date announcements
[point your browser to http://www.scons.org/]
- Update the tigris.org web site:
+ Update the project pages at tigris.org:
svn co http://scons.tigris.org/svn/scons/trunk
# to what we expect. (If we derived the version number from the same
# data driving the build we might miss errors if the logic breaks.)
-SConsVersion = '0.96.94'
+SConsVersion = '0.96.96'
__all__.extend([ 'TestSCons',
'python',
self.QT = self.workpath(dir)
self.QT_LIB = 'myqt'
- self.QT_MOC = '%s %s' % (python, self.workpath(dir, 'bin', 'mymoc.py'))
- self.QT_UIC = '%s %s' % (python, self.workpath(dir, 'bin', 'myuic.py'))
+ self.QT_MOC = '%s %s' % (_python_, self.workpath(dir, 'bin', 'mymoc.py'))
+ self.QT_UIC = '%s %s' % (_python_, self.workpath(dir, 'bin', 'myuic.py'))
self.QT_LIB_DIR = self.workpath(dir, 'lib')
def Qt_create_SConstruct(self, place):
"""Returns a full path to the executable (MSDEV or devenv)
for the specified version of Visual Studio.
"""
- sub_path = {
- '6.0' : ['Common', 'MSDev98', 'Bin', 'MSDEV.COM'],
- '7.0' : ['Common7', 'IDE', 'devenv.com'],
- '7.1' : ['Common7', 'IDE', 'devenv.com'],
- '8.0' : ['Common7', 'IDE', 'devenv.com'],
+ common_msdev98_bin_msdev_com = ['Common', 'MSDev98', 'Bin', 'MSDEV.COM']
+ common7_ide_devenv_com = ['Common7', 'IDE', 'devenv.com']
+ common7_ide_vcexpress_exe = ['Common7', 'IDE', 'VCExpress.exe']
+ sub_paths = {
+ '6.0' : [
+ common_msdev98_bin_msdev_com,
+ ],
+ '7.0' : [
+ common7_ide_devenv_com,
+ ],
+ '7.1' : [
+ common7_ide_devenv_com,
+ ],
+ '8.0' : [
+ common7_ide_devenv_com,
+ common7_ide_vcexpress_exe,
+ ],
}
from SCons.Tool.msvs import get_msvs_install_dirs
vs_path = get_msvs_install_dirs(version)['VSINSTALLDIR']
- return apply(os.path.join, [vs_path] + sub_path[version])
+ for sp in sub_paths[version]:
+ p = apply(os.path.join, [vs_path] + sp)
+ if os.path.exists(p):
+ return p
+ return apply(os.path.join, [vs_path] + sub_paths[version][0])
# In some environments, $AR will generate a warning message to stderr
# if the library doesn't previously exist and is being created. One
-- (Optional.) Install from a pre-packaged SCons package that
does not require distutils:
- Red Hat Linux scons-0.96.94.noarch.rpm
+ Red Hat Linux scons-0.96.96.noarch.rpm
- Debian GNU/Linux scons_0.96.94_all.deb
- (or use apt-get)
+ Debian GNU/Linux use apt-get to get the official package
- Windows scons-0.96.94.win32.exe
+ Windows scons-0.96.96.win32.exe
-- (Recommended.) Download the latest distutils package from the
following URL:
By default, the above commands will do the following:
- -- Install the version-numbered "scons-0.96.94" and "sconsign-0.96.94"
+ -- Install the version-numbered "scons-0.96.96" and "sconsign-0.96.96"
scripts in the default system script directory (/usr/bin or
C:\Python*\Scripts, for example). This can be disabled by
specifying the "--no-version-script" option on the command
if you want to install and experiment with a new version before
making it the default on your system. On UNIX or Linux systems,
you can have the "scons" and "sconsign" scripts be hard links or
- symbolic links to the "scons-0.96.94" and "sconsign-0.96.94" scripts
+ symbolic links to the "scons-0.96.96" and "sconsign-0.96.96" scripts
by specifying the "--hardlink-scons" or "--symlink-scons"
options on the command line.
- -- Install "scons-0.96.94.bat" and "scons.bat" wrapper scripts in the
+ -- Install "scons-0.96.96.bat" and "scons.bat" wrapper scripts in the
Python prefix directory on Windows (C:\Python*, for example).
This can be disabled by specifying the "--no-install-bat" option
on the command line. On UNIX or Linux systems, the
- "--install-bat" option may be specified to have "scons-0.96.94.bat"
+ "--install-bat" option may be specified to have "scons-0.96.96.bat"
and "scons.bat" files installed in the default system script
directory, which is useful if you want to install SCons in a
shared file system directory that can be used to execute SCons
-- Install the SCons build engine (a Python module) in an
appropriate version-numbered SCons library directory
- (/usr/lib/scons-0.96.94 or C:\Python*\scons-0.96.94, for example).
+ (/usr/lib/scons-0.96.96 or C:\Python*\scons-0.96.96, for example).
See below for more options related to installing the build
engine library.
$ python runtest.py -a
- Be patient, there are more than 500 test scripts in the
+ Be patient, there are more than 700 test scripts in the
whole suite.
If any test scripts fail, they will be listed in a summary at
Depending on the utilities installed on your system, any or all of the
following packages will be built:
- build/dist/scons-0.96.94-1.noarch.rpm
- build/dist/scons-0.96.94-1.src.rpm
- build/dist/scons-0.96.94.linux-i686.tar.gz
- build/dist/scons-0.96.94.tar.gz
- build/dist/scons-0.96.94.win32.exe
- build/dist/scons-0.96.94.zip
- build/dist/scons-doc-0.96.94.tar.gz
- build/dist/scons-local-0.96.94.tar.gz
- build/dist/scons-local-0.96.94.zip
- build/dist/scons-src-0.996.94tar.gz
- build/dist/scons-src-0.96.94.zip
- build/dist/scons_0.96.94-1_all.deb
+ build/dist/scons-0.96.96-1.noarch.rpm
+ build/dist/scons-0.96.96-1.src.rpm
+ build/dist/scons-0.96.96.linux-i686.tar.gz
+ build/dist/scons-0.96.96.tar.gz
+ build/dist/scons-0.96.96.win32.exe
+ build/dist/scons-0.96.96.zip
+ build/dist/scons-doc-0.96.96.tar.gz
+ build/dist/scons-local-0.96.96.tar.gz
+ build/dist/scons-local-0.96.96.zip
+ build/dist/scons-src-0.96.96.tar.gz
+ build/dist/scons-src-0.96.96.zip
+ build/dist/scons_0.96.96-1_all.deb
The SConstruct file is supposed to be smart enough to avoid trying to
build packages for which you don't have the proper utilities installed.
Chad Austin
Charles Crain
Steve Leblanc
+ Greg Noel
Gary Oberbrunner
Anthony Roach
Greg Spencer
import time
project = 'scons'
-default_version = '0.96.94'
+default_version = '0.96.96'
copyright = "Copyright (c) %s The SCons Foundation" % copyright_years
SConsignFile()
'sconsign.1',
'scons-time.1',
'script/scons.bat',
- 'script/scons-post-install.py',
+ #'script/scons-post-install.py',
'setup.cfg',
'setup.py',
],
])
old = os.path.join('lib', 'scons', '')
- new = os.path.join('lib', 'python2.2', 'site-packages', '')
+ new = os.path.join('lib', 'python' + python_ver, 'site-packages', '')
def xxx(s, old=old, new=new):
if s[:len(old)] == old:
s = new + s[len(old):]
base_sys_path = [os.getcwd() + '/build/test-tar-gz/lib/scons'] + sys.path
helpstr = """\
-Usage: scons-varlist.py [--man|--sgml] \
+Usage: scons-proc.py [--man|--sgml] \
[-b file(s)] [-t file(s)] [-v file(s)] [infile ...]
Options:
-b file(s) dump builder information to the specified file(s)
*
* Look in aesub(5) for more information about command substitutions.
*/
-build_command = "python2.4 ${Source bootstrap.py} -Y${SUBSTitute : \\ -Y $Search_Path} date='${DAte %Y/%m/%d %H:%M:%S}' developer=${DEVeloper} version=${VERsion} change=${Change}";
+build_command = "python2.1 ${Source bootstrap.py} -Y${SUBSTitute : \\ -Y $Search_Path} date='${DAte %Y/%m/%d %H:%M:%S}' developer=${DEVeloper} version=${VERsion} change=${Change}";
/*
* SCons removes its targets before constructing them, which qualifies it
-scons (0.96-94) unstable; urgency=low
+scons (0.96-96) unstable; urgency=low
* Pre-release of eighth beta release.
- -- Steven Knight <knight@baldmt.com> Sun, 07 Jan 2007 18:36:20 -0600
+ -- Steven Knight <knight@baldmt.com> Thu, 12 Apr 2007 12:36:25 -0500
scons (0.96-1) unstable; urgency=low
Section: devel
Priority: optional
Maintainer: Moshe Zadka <moshez@debian.org>
-Build-Depends-Indep: debhelper (>> 2.0.0), python2.2-dev
+Build-Depends-Indep: debhelper (>> 2.0.0), python-dev (>> 2.2)
Standards-Version: 3.5.6
Package: scons
Architecture: all
-Depends: python2.2
+Depends: python (>> 2.2)
Description: A replacement for Make
SCons is an Open Source software construction tool--that is, a build
tool; an improved substitute for the classic Make utility; a better
usr/bin
-usr/lib/python2.2/site-packages
usr/share/doc/scons
usr/share/man/man1
fi
NAME=scons
+PYTHON_VERSION=`python -V 2>&1| cut -d" " -f2 | cut -d"." -f0-2`
+PYTHON_EXE_NAME=`which python$PYTHON_VERSION`
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
dpkg --listfiles $NAME | grep '\.py$' | \
- xargs -n 1 /usr/bin/python2.2 -c 'import py_compile,sys;py_compile.compile(sys.argv[1])'
+ xargs -n 1 $PYTHON_EXE_NAME -c 'import py_compile,sys;py_compile.compile(sys.argv[1])'
dpkg --listfiles $NAME | grep '\.py$' | \
- xargs -n 1 /usr/bin/python2.2 -O -c 'import py_compile,sys;py_compile.compile(sys.argv[1])'
+ xargs -n 1 $PYTHON_EXE_NAME -O -c 'import py_compile,sys;py_compile.compile(sys.argv[1])'
;;
esac
# Overridable variables added to support building test .deb files
# as part of routine SCons builds. --SK
BUILDDEB_OPTIONS=
-PYTHON=/usr/bin/python2.2
+PYTHON_VERSION=`python -V 2>&1| cut -d" " -f2 | cut -d"." -f0-2`
+PYTHON_PATH=/usr/bin/python
+PYTHON=$(PYTHON_PATH)$(PYTHON_VERSION)
#######
# Uncomment this to turn on verbose mode.
@# already exist on our non-Debian test build systems. Hence,
@# we do a lot of mkdir -p and rm -f here... --SK
@########
- mkdir -p debian/scons/usr/lib/python2.2/site-packages/
- rm -rf debian/scons/usr/lib/python2.2/site-packages/SCons
- cp -r build/lib/SCons debian/scons/usr/lib/python2.2/site-packages/
+ mkdir -p debian/scons/usr/lib/python$(PYTHON_VERSION)/site-packages/
+ rm -rf debian/scons/usr/lib/python$(PYTHON_VERSION)/site-packages/SCons
+ cp -r build/lib/SCons debian/scons/usr/lib/python$(PYTHON_VERSION)/site-packages/
mkdir -p debian/scons/usr/bin/
rm -f debian/scons/usr/bin/scons
# if lynx is available to do the dump.
#
fig2dev = whereis('fig2dev')
+epydoc = whereis('epydoc')
groff = whereis('groff')
lynx = whereis('lynx')
man2html = whereis('man2html')
tar_deps.append(html)
tar_list.append(html)
+if epydoc:
+ # XXX Should be in common with reading the same thing in
+ # the SConstruct file.
+ e = os.path.join('#src', 'engine')
+ manifest_in = File(os.path.join(e, 'MANIFEST.in')).rstr()
+ sources = map(lambda x: x[:-1], open(manifest_in).readlines())
+ sources = filter(lambda x: string.find(x, 'Optik') == -1, sources)
+ sources = filter(lambda x: string.find(x, 'Platform') == -1, sources)
+ sources = filter(lambda x: string.find(x, 'Tool') == -1, sources)
+ # XXX
+ sources = filter(lambda x: string.find(x, 'Options') == -1, sources)
+
+ e = os.path.join(build, '..', 'scons', 'engine')
+ sources = map(lambda x, e=e: os.path.join(e, x), sources)
+
+ epydoc_commands = [
+ Delete('$OUTDIR'),
+ '$EPYDOC $EPYDOCFLAGS --output $OUTDIR --docformat=restructuredText --name SCons --url http://www.scons.org/ $SOURCES',
+ Touch('$TARGET'),
+ ]
+
+ htmldir = os.path.join(build, 'HTML', 'scons-api')
+ env.Command('${OUTDIR}/index.html', sources, epydoc_commands,
+ EPYDOC=epydoc, EPYDOCFLAGS='--html', OUTDIR=htmldir)
+ tar_deps.append(htmldir)
+ tar_list.append(htmldir)
+
+ # PDF and PostScript and TeX are built from the
+ # same invocation.
+ api_dir = os.path.join(build, 'scons-api')
+ api_pdf = os.path.join(api_dir, 'api.pdf')
+ api_ps = os.path.join(api_dir, 'api.ps')
+ api_tex = os.path.join(api_dir, 'api.tex')
+ api_targets = [api_pdf, api_ps, api_tex]
+ env.Command(api_targets, sources, epydoc_commands,
+ EPYDOC=epydoc, EPYDOCFLAGS='--pdf', OUTDIR=api_dir)
+ Local(api_targets)
+
+ pdf_install = os.path.join(build, 'PDF', 'scons-api.pdf')
+ env.InstallAs(pdf_install, api_pdf)
+ tar_deps.append(pdf_install)
+ tar_list.append(pdf_install)
+ Local(pdf_install)
+
+ ps_install = os.path.join(build, 'PS', 'scons-api.ps')
+ env.InstallAs(ps_install, api_ps)
+ tar_deps.append(ps_install)
+ tar_list.append(ps_install)
+ Local(ps_install)
+
#
# Now actually create the tar file of the documentation,
# for easy distribution to the web site.
#
if tar_deps:
- tar_list = string.join(map(lambda x: x[11:], tar_list))
+ tar_list = string.join(map(lambda x, b=build+'/': string.replace(x, b, ''),
+ tar_list))
env.Command(doc_tar_gz, tar_deps,
- "tar cf${TAR_HFLAG} - -C build/doc %s | gzip > $TARGET" % tar_list)
+ "tar cf${TAR_HFLAG} - -C %s %s | gzip > $TARGET" % (build, tar_list))
Local(doc_tar_gz)
.ES
import os
-env = Environment(ENV = os.environ['PATH'])
+env = Environment(ENV = os.environ)
.EE
This comes at the expense of making your build
.TP
--debug=time
-Prints various time profiling information: the time spent
-executing each build command, the total build time, the total time spent
-executing build commands, the total time spent executing SConstruct and
-SConscript files, and the total time spent executing SCons itself.
+Prints various time profiling information:
+the time spent executing each individual build command;
+the total build time (time SCons ran from beginning to end);
+the total time spent reading and executing SConscript files;
+the total time spent SCons itself spend running
+(that is, not counting reading and executing SConscript files);
+and both the total time spent executing all build commands
+and the elapsed wall-clock time spent executing those build commands.
+(When
+.B scons
+is executed without the
+.B -j
+option,
+the elapsed wall-clock time will typically
+be slightly longer than the total time spent
+executing all the build commands,
+due to the SCons processing that takes place
+in between executing each command.
+When
+.B scons
+is executed
+.I with
+the
+.B -j
+option,
+and your build configuration allows good parallelization,
+the elapsed wall-clock time should
+be significantly smaller than the
+total time spent executing all the build commands,
+since multiple build commands and
+intervening SCons processing
+should take place in parallel.)
.TP
--debug=tree
or if a file really does exist
where the SCons configuration expects a directory).
+.TP
+.RI --duplicate= ORDER
+There are three ways to duplicate files in a build tree: hard links,
+soft (symbolic) links and copies. The default behaviour of SCons is to
+prefer hard links to soft links to copies. You can specify different
+behaviours with this option.
+.IR ORDER
+must be one of
+.IR hard-soft-copy
+(the default),
+.IR soft-hard-copy ,
+.IR hard-copy ,
+.IR soft-copy
+or
+.IR copy .
+SCons will attempt to duplicate files using
+the mechanisms in the specified order.
+
.\" .TP
.\" -e, --environment-overrides
.\" Variables from the execution environment override construction
options
are used, the directories are searched in the order specified.
-.TP
-.RI --no-site-dir
-Prevents the automatic addition of the standard
-.I site_scons
-dir to
-.IR sys.path .
-Also prevents loading the
-.I site_scons/site_init.py
-module if it exists, and prevents adding
-.I site_scons/site_tools
-to the toolpath.
-
.TP
--implicit-cache
-Cache implicit dependencies. This can cause
+Cache implicit dependencies.
+This causes
+.B scons
+to use the implicit (scanned) dependencies
+from the last time it was run
+instead of scanning the files for implicit dependencies.
+This can significantly speed up SCons,
+but with the following limitations:
+.IP
.B scons
-to miss changes in the implicit dependencies in cases where a new implicit
+will not detect changes to implicit dependency search paths
+(e.g.
+.BR CPPPATH ", " LIBPATH )
+that would ordinarily
+cause different versions of same-named files to be used.
+.IP
+.B scons
+will miss changes in the implicit dependencies
+in cases where a new implicit
dependency is added earlier in the implicit dependency search path
-(e.g. CPPPATH) than a current implicit dependency with the same name.
+(e.g.
+.BR CPPPATH ", " LIBPATH )
+than a current implicit dependency with the same name.
.TP
--implicit-deps-changed
-Force SCons to ignore the cached implicit dependencies. This causes the
+Forces SCons to ignore the cached implicit dependencies. This causes the
implicit dependencies to be rescanned and recached. This implies
.BR --implicit-cache .
.\" .I N
.\" (a floating-point number).
-.TP
-.RI --duplicate= ORDER
-There are three ways to duplicate files in a build tree: hard links,
-soft (symbolic) links and copies. The default behaviour of SCons is to
-prefer hard links to soft links to copies. You can specify different
-behaviours with this option.
-.IR ORDER
-must be one of
-.IR hard-soft-copy
-(the default),
-.IR soft-hard-copy ,
-.IR hard-copy ,
-.IR soft-copy
-or
-.IR copy .
-SCons will attempt to duplicate files using
-the mechanisms in the specified order.
-
.\"
.\" .TP
.\" --list-derived
No execute. Print the commands that would be executed to build
any out-of-date target files, but do not execute the commands.
+.TP
+.RI --no-site-dir
+Prevents the automatic addition of the standard
+.I site_scons
+dir to
+.IR sys.path .
+Also prevents loading the
+.I site_scons/site_init.py
+module if it exists, and prevents adding
+.I site_scons/site_tools
+to the toolpath.
+
.\" .TP
.\" .RI -o " file" ", --old-file=" file ", --assume-old=" file
.\" Do not rebuild
method has been activated.
The specified targets may be a list
or an individual target.
-Multiple calls to
-.BR NoCache ()
-are legal,
-and prevent each specified target
-from being removed by calls to the
-.B -c
-option.
Multiple files should be specified
either as separate arguments to the
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
-.RI ParseDepends( filename ", [" must_exist ])
+.RI ParseDepends( filename ", [" must_exist ", " only_one ])
.TP
-.RI env.ParseDepends( filename ", [" must_exist " " only_one ])
+.RI env.ParseDepends( filename ", [" must_exist ", " only_one ])
Parses the contents of the specified
.I filename
as a list of dependencies in the style of
.I filename
does not exist.
The optional
-.I must_exit
+.I must_exist
argument may be set to a non-zero
value to have
scons
-->
+<!ENTITY config "<literal>--config</literal>">
<!ENTITY debug-explain "<literal>--debug=explain</literal>">
+<!ENTITY debug-findlibs "<literal>--debug=findlibs</literal>">
+<!ENTITY debug-includes "<literal>--debug=includes</literal>">
+<!ENTITY debug-presub "<literal>--debug=presub</literal>">
+<!ENTITY debug-stacktrace "<literal>--debug=stacktrace</literal>">
<!ENTITY implicit-cache "<literal>--implicit-cache</literal>">
<!ENTITY implicit-deps-changed "<literal>--implicit-deps-changed</literal>">
<!ENTITY implicit-deps-unchanged "<literal>--implicit-deps-unchanged</literal>">
+<!ENTITY profile "<literal>--profile</literal>">
+<!ENTITY taskmastertrace "<literal>--taskmastertrace</literal>">
+<!ENTITY tree "<literal>--tree</literal>">
<!ENTITY Q "<literal>-Q</literal>">
<!--
-->
<!ENTITY Add "<function>Add</function>">
+<!ENTITY AddPostAction "<function>AddPostAction</function>">
+<!ENTITY AddPreAction "<function>AddPreAction</function>">
<!ENTITY AddOptions "<function>AddOptions</function>">
<!ENTITY Alias "<function>Alias</function>">
<!ENTITY Aliases "<function>Aliases</function>">
+<!ENTITY AlwaysBuild "<function>AlwaysBuild</function>">
<!ENTITY Append "<function>Append</function>">
+<!ENTITY AppendENVPath "<function>AppendENVPath</function>">
+<!ENTITY AppendUnique "<function>AppendUnique</function>">
<!ENTITY BoolOption "<function>BoolOption</function>">
<!ENTITY Build "<function>Build</function>">
<!ENTITY CacheDir "<function>CacheDir</function>">
<!ENTITY Execute "<function>Execute</function>">
<!ENTITY Export "<function>Export</function>">
<!ENTITY File "<function>File</function>">
+<!ENTITY FindFile "<function>FindFile</function>">
<!ENTITY Finish "<function>Finish</function>">
<!ENTITY GenerateHelpText "<function>GenerateHelpText</function>">
<!ENTITY GetOption "<function>GetOption</function>">
<!ENTITY Module "<function>Module</function>">
<!ENTITY Move "<function>Move</function>">
<!ENTITY NoClean "<function>NoClean</function>">
+<!ENTITY NoCache "<function>NoCache</function>">
<!ENTITY Objects "<function>Objects</function>">
<!ENTITY Options "<function>Options</function>">
<!ENTITY PackageOption "<function>PackageOption</function>">
<!ENTITY PathOption_PathIsFile "<function>PathOption.PathIsFile</function>">
<!ENTITY Precious "<function>Precious</function>">
<!ENTITY Prepend "<function>Prepend</function>">
+<!ENTITY PrependENVPath "<function>PrependENVPath</function>">
+<!ENTITY PrependUnique "<function>PrependUnique</function>">
<!ENTITY Replace "<function>Replace</function>">
<!ENTITY Repository "<function>Repository</function>">
<!ENTITY Return "<function>Return</function>">
<!ENTITY Salt "<function>Salt</function>">
<!ENTITY SetBuildSignatureType "<function>SetBuildSignatureType</function>">
<!ENTITY SetContentSignatureType "<function>SetContentSignatureType</function>">
+<!ENTITY SideEffect "<function>SideEffect</function>">
<!ENTITY SourceSignature "<function>SourceSignature</function>">
<!ENTITY SourceSignatures "<function>SourceSignatures</function>">
<!ENTITY Split "<function>Split</function>">
caching.sgml
command-line.sgml
cons.pl
-cons.sgml
copyright.sgml
depends.sgml
ENV.sgml
&SCons; provides separate Builder objects
to create static and shared object files.
- The distinction becomes especially important when
+ The distinction becomes especially important when
archiving object files into different types of libraries.
</para>
<para>
- XXX
+ XXX PCH()
</para>
<para>
- XXX
+ XXX RES()
</para>
<para>
- XXX
+ XXX CFile()
</para>
<programlisting>
- XXX
+ XXX CFile() programlisting
</programlisting>
<screen>
- XXX
+ XXX CFile() screen
</screen>
</section>
<para>
- XXX
+ XXX CXXFILE()
</para>
<programlisting>
- XXX
+ XXX CXXFILE() programlisting
</programlisting>
<screen>
- XXX
+ XXX CXXFILE() screen
</screen>
</section>
<para>
- XXX
+ XXX DVI() para
</para>
<programlisting>
- XXX
+ XXX DVI() programlisting
</programlisting>
<screen>
- XXX
+ XXX DVI() screen
</screen>
</section>
<para>
- XXX
+ XXX PDF() para
</para>
<para>
- XXX
+ XXX PostScript() para
</para>
<programlisting>
- XXX
+ XXX PostScript() programlisting
</programlisting>
<screen>
- XXX
+ XXX PostScript() screen
</screen>
</section>
</para>
<screen>
- XXX
+ XXX Java() screen
</screen>
</section>
<para>
- The &Jar; builder object XXX
+ XXX The &Jar; builder object
</para>
</programlisting>
<screen>
- XXX
+ XXX Jar() screen
</screen>
</section>
<para>
- XXX
+ XXX JavaH() para
</para>
<programlisting>
- XXX
+ XXX JavaH() programlisting
</programlisting>
<screen>
- XXX
+ XXX JavaH() screen
</screen>
</section>
<para>
- XXX
+ XXX RMIC() para
</para>
<programlisting>
- XXX
+ XXX RMIC() programlisting
</programlisting>
<screen>
- XXX
+ XXX RMIC() screen
</screen>
</section>
&SCons; provides separate Builder objects
to create static and shared object files.
- The distinction becomes especially important when
+ The distinction becomes especially important when
archiving object files into different types of libraries.
</para>
<para>
- XXX
+ XXX PCH()
</para>
<para>
- XXX
+ XXX RES()
</para>
<para>
- XXX
+ XXX CFile()
</para>
<programlisting>
- XXX
+ XXX CFile() programlisting
</programlisting>
<screen>
- XXX
+ XXX CFile() screen
</screen>
</section>
<para>
- XXX
+ XXX CXXFILE()
</para>
<programlisting>
- XXX
+ XXX CXXFILE() programlisting
</programlisting>
<screen>
- XXX
+ XXX CXXFILE() screen
</screen>
</section>
<para>
- XXX
+ XXX DVI() para
</para>
<programlisting>
- XXX
+ XXX DVI() programlisting
</programlisting>
<screen>
- XXX
+ XXX DVI() screen
</screen>
</section>
<para>
- XXX
+ XXX PDF() para
</para>
<para>
- XXX
+ XXX PostScript() para
</para>
<programlisting>
- XXX
+ XXX PostScript() programlisting
</programlisting>
<screen>
- XXX
+ XXX PostScript() screen
</screen>
</section>
</para>
<screen>
- XXX
+ XXX Java() screen
</screen>
</section>
<para>
- The &Jar; builder object XXX
+ XXX The &Jar; builder object
</para>
</programlisting>
<screen>
- XXX
+ XXX Jar() screen
</screen>
</section>
<para>
- XXX
+ XXX JavaH() para
</para>
<programlisting>
- XXX
+ XXX JavaH() programlisting
</programlisting>
<screen>
- XXX
+ XXX JavaH() screen
</screen>
</section>
<para>
- XXX
+ XXX RMIC() para
</para>
<programlisting>
- XXX
+ XXX RMIC() programlisting
</programlisting>
<screen>
- XXX
+ XXX RMIC() screen
</screen>
</section>
generator is being called to contribute to a build signature,
as opposed to actually executing the command.
- <!-- XXX NEED MORE HERE -->
+ <!-- XXX NEED MORE HERE, describe generators use in signatures -->
</para>
</listitem>
</scons_output>
<programlisting>
- bld = Builder(action = 'XXX',
+ bld = Builder(action = 'my_command',
suffix = '.foo',
src_suffix = '.input',
emitter = 'MY_EMITTER')
<para>
- XXX
+ XXX para
</para>
<scons_example name="ex8">
<file name="SConstruct" printme="1">
env = Environment()
- #env.SourceCode('.', env.BitKeeper('XXX'))
+ #env.SourceCode('.', env.BitKeeper('my_command'))
env.Program('hello.c')
</file>
<file name="hello.c">
generator is being called to contribute to a build signature,
as opposed to actually executing the command.
- <!-- XXX NEED MORE HERE -->
+ <!-- XXX NEED MORE HERE, describe generators use in signatures -->
</para>
</listitem>
</screen>
<programlisting>
- bld = Builder(action = 'XXX',
+ bld = Builder(action = 'my_command',
suffix = '.foo',
src_suffix = '.input',
emitter = 'MY_EMITTER')
<para>
- XXX
+ XXX para
</para>
<scons_example name="ex8">
<file name="SConstruct" printme="1">
env = Environment()
- #env.SourceCode('.', env.BitKeeper('XXX'))
+ #env.SourceCode('.', env.BitKeeper('my_command'))
env.Program('hello.c')
</file>
<file name="hello.c">
every time a file is built,
it is stored in the shared cache directory
along with its MD5 build signature.
+ <footnote>
+ <para>
+ Actually, the MD5 signature is used as the name of the file
+ in the shared cache directory in which the contents are stored.
+ </para>
+ </footnote>
On subsequent builds,
before an action is invoked to build a file,
&SCons; will check the shared cache directory
<para>
One potential drawback to using a shared cache
- is that your build output can be inconsistent
- from invocation to invocation,
+ is that the output printed by &SCons;
+ can be inconsistent from invocation to invocation,
because any given file may be rebuilt one time
and retrieved from the shared cache the next time.
This can make analyzing build output more difficult,
</section>
<section>
- <title>Not Retrieving Files From a Shared Cache</title>
+ <title>Not Using the Shared Cache for Specific Files</title>
+
+ <para>
+
+ You may want to disable caching for certain
+ specific files in your configuration.
+ For example, if you only want to put
+ executable files in a central cache,
+ but not the intermediate object files,
+ you can use the &NoCache;
+ function to specify that the
+ object files should not be cached:
+
+ </para>
+
+ <scons_example name="ex-NoCache">
+ <file name="SConstruct" printme="1">
+ env = Environment()
+ obj = env.Object('hello.c')
+ env.Program('hello.c')
+ CacheDir('cache')
+ NoCache('hello.o')
+ </file>
+ <file name="hello.c">
+ hello.c
+ </file>
+ <directory name="cache">
+ </directory>
+ </scons_example>
+
+ <para>
+
+ Then when you run &scons; after cleaning
+ the built targets,
+ it will recompile the object file locally
+ (since it doesn't exist in the shared cache directory),
+ but still realize that the shared cache directory
+ contains an up-to-date executable program
+ that can be retrieved instead of re-linking:
+
+ </para>
+
+ <!--
+
+ <scons_output example="ex1">
+ <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q -c</scons_output_command>
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
+
+ -->
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ cc -o hello.o -c hello.c
+ cc -o hello hello.o
+ % <userinput>scons -Q -c</userinput>
+ Removed hello.o
+ Removed hello
+ % <userinput>scons -Q</userinput>
+ cc -o hello.o -c hello.c
+ Retrieved `hello' from cache
+ </screen>
+
+ </section>
+
+ <section>
+ <title>Disabling the Shared Cache</title>
<para>
In this case, you can use the
the <literal>--cache-force</literal> option
to tell &SCons; to put all derived files in the cache,
- even if the files had already been built
- by a previous invocation:
+ even if the files already exist in your local tree
+ from having been built by a previous invocation:
</para>
<scons_output_command>scons -Q -c</scons_output_command>
<scons_output_command>scons -Q --cache-disable</scons_output_command>
<scons_output_command>scons -Q --cache-force</scons_output_command>
- <scons_output_command>scons -Q -c</scons_output_command>
<scons_output_command>scons -Q</scons_output_command>
</scons_output>
demonstrates that the <literal>--cache-disable</literal>
option avoids putting the built
<filename>hello.o</filename>
- and
+ and
<filename>hello</filename> files in the cache,
but after using the <literal>--cache-force</literal> option,
the files have been put in the cache
</para>
</section>
+
+ <section>
+ <title>Minimizing Cache Contention: the <literal>--random</literal> Option</title>
+
+ <para>
+
+ If you allow multiple builds to update the
+ shared cache directory simultaneously,
+ two builds that occur at the same time
+ can sometimes start "racing"
+ with one another to build the same files
+ in the same order.
+ If, for example,
+ you are linking multiple files into an executable program:
+
+ </para>
+
+ <scons_example name="ex-random">
+ <file name="SConstruct" printme="1">
+ Program('prog',
+ ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c'])
+ </file>
+ <file name="f1.c">f1.c</file>
+ <file name="f2.c">f2.c</file>
+ <file name="f3.c">f3.c</file>
+ <file name="f4.c">f4.c</file>
+ <file name="f5.c">f5.c</file>
+ <file name="f6.c">f6.c</file>
+ </scons_example>
+
+ <para>
+
+ &SCons; will normally build the input object files
+ on which the program depends in their normal, sorted order:
+
+ </para>
+
+ <scons_output example="ex-random">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ But if two such builds take place simultaneously,
+ they may each look in the cache at nearly the same
+ time and both decide that <filename>f1.o</filename>
+ must be rebuilt and pushed into the shared cache directory,
+ then both decide that <filename>f2.o</filename>
+ must be rebuilt (and pushed into the shared cache directory),
+ then both decide that <filename>f3.o</filename>
+ must be rebuilt...
+ This won't cause any actual build problems--both
+ builds will succeed,
+ generate correct output files,
+ and populate the cache--but
+ it does represent wasted effort.
+
+ </para>
+
+ <para>
+
+ To alleviate such contention for the cache,
+ you can use the <literal>--random</literal> command-line option
+ to tell &SCons; to build dependencies
+ in a random order:
+
+ </para>
+
+ <!--
+
+ The following <screen> output was generated by this:
+
+ <scons_output example="ex-random">
+ <scons_output_command>scons -Q - -random</scons_output_command>
+ </scons_output>
+
+ We captured it directly here to guarantee a "random" order,
+ guarding against the potential for - -random to happen
+ to return things in the original sorted order.
+
+ -->
+
+ <screen>
+ % <userinput>scons -Q --random</userinput>
+ cc -o f3.o -c f3.c
+ cc -o f1.o -c f1.c
+ cc -o f5.o -c f5.c
+ cc -o f2.o -c f2.c
+ cc -o f4.o -c f4.c
+ cc -o prog f1.o f2.o f3.o f4.o f5.o
+ </screen>
+
+ <para>
+
+ Multiple builds using the <literal>--random</literal> option
+ will usually build their dependencies in different,
+ random orders,
+ which minimizes the chances for a lot of
+ contention for same-named files
+ in the shared cache directory.
+ Multiple simultaneous builds might still race to try to build
+ the same target file on occasion,
+ but long sequences of inefficient contention
+ should be rare.
+
+ </para>
+
+ <para>
+
+ Note, of course,
+ the <literal>--random</literal> option
+ will cause the output that &SCons; prints
+ to be inconsistent from invocation to invocation,
+ which may be an issue when
+ trying to compare output from different build runs.
+
+ </para>
+
+ </section>
+
+ <!--
+
+ <section>
+ <title>Troubleshooting Shared Caching: the &cache-debug; Option</title>
+
+ <para>
+
+ XXX describe the - - cache-debug option
+ XXX maybe point to the troubleshooting appendix?
+
+ </para>
+
+ </section>
+
+ -->
+
+ <!--
+
+ <section>
+
+ <para>
+
+ XXX describe CacheDir management: monitoring, deleting, etc.
+
+ </para>
+
+ </section>
+
+ -->
every time a file is built,
it is stored in the shared cache directory
along with its MD5 build signature.
+ <footnote>
+ <para>
+ Actually, the MD5 signature is used as the name of the file
+ in the shared cache directory in which the contents are stored.
+ </para>
+ </footnote>
On subsequent builds,
before an action is invoked to build a file,
&SCons; will check the shared cache directory
<para>
One potential drawback to using a shared cache
- is that your build output can be inconsistent
- from invocation to invocation,
+ is that the output printed by &SCons;
+ can be inconsistent from invocation to invocation,
because any given file may be rebuilt one time
and retrieved from the shared cache the next time.
This can make analyzing build output more difficult,
</section>
<section>
- <title>Not Retrieving Files From a Shared Cache</title>
+ <title>Not Using the Shared Cache for Specific Files</title>
+
+ <para>
+
+ You may want to disable caching for certain
+ specific files in your configuration.
+ For example, if you only want to put
+ executable files in a central cache,
+ but not the intermediate object files,
+ you can use the &NoCache;
+ function to specify that the
+ object files should not be cached:
+
+ </para>
+
+ <programlisting>
+ env = Environment()
+ obj = env.Object('hello.c')
+ env.Program('hello.c')
+ CacheDir('cache')
+ NoCache('hello.o')
+ </programlisting>
+
+ <para>
+
+ Then when you run &scons; after cleaning
+ the built targets,
+ it will recompile the object file locally
+ (since it doesn't exist in the shared cache directory),
+ but still realize that the shared cache directory
+ contains an up-to-date executable program
+ that can be retrieved instead of re-linking:
+
+ </para>
+
+ <!--
+
+ <scons_output example="ex1">
+ <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q -c</scons_output_command>
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
+
+ -->
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ cc -o hello.o -c hello.c
+ cc -o hello hello.o
+ % <userinput>scons -Q -c</userinput>
+ Removed hello.o
+ Removed hello
+ % <userinput>scons -Q</userinput>
+ cc -o hello.o -c hello.c
+ Retrieved `hello' from cache
+ </screen>
+
+ </section>
+
+ <section>
+ <title>Disabling the Shared Cache</title>
<para>
In this case, you can use the
the <literal>--cache-force</literal> option
to tell &SCons; to put all derived files in the cache,
- even if the files had already been built
- by a previous invocation:
+ even if the files already exist in your local tree
+ from having been built by a previous invocation:
</para>
cc -o hello hello.o
% <userinput>scons -Q --cache-force</userinput>
scons: `.' is up to date.
- % <userinput>scons -Q -c</userinput>
- Removed hello.o
- Removed hello
% <userinput>scons -Q</userinput>
- Retrieved `hello.o' from cache
- Retrieved `hello' from cache
+ scons: `.' is up to date.
</screen>
<para>
demonstrates that the <literal>--cache-disable</literal>
option avoids putting the built
<filename>hello.o</filename>
- and
+ and
<filename>hello</filename> files in the cache,
but after using the <literal>--cache-force</literal> option,
the files have been put in the cache
</para>
</section>
+
+ <section>
+ <title>Minimizing Cache Contention: the <literal>--random</literal> Option</title>
+
+ <para>
+
+ If you allow multiple builds to update the
+ shared cache directory simultaneously,
+ two builds that occur at the same time
+ can sometimes start "racing"
+ with one another to build the same files
+ in the same order.
+ If, for example,
+ you are linking multiple files into an executable program:
+
+ </para>
+
+ <programlisting>
+ Program('prog',
+ ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c'])
+ </programlisting>
+
+ <para>
+
+ &SCons; will normally build the input object files
+ on which the program depends in their normal, sorted order:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ cc -o f1.o -c f1.c
+ cc -o f2.o -c f2.c
+ cc -o f3.o -c f3.c
+ cc -o f4.o -c f4.c
+ cc -o f5.o -c f5.c
+ cc -o prog f1.o f2.o f3.o f4.o f5.o
+ </screen>
+
+ <para>
+
+ But if two such builds take place simultaneously,
+ they may each look in the cache at nearly the same
+ time and both decide that <filename>f1.o</filename>
+ must be rebuilt and pushed into the shared cache directory,
+ then both decide that <filename>f2.o</filename>
+ must be rebuilt (and pushed into the shared cache directory),
+ then both decide that <filename>f3.o</filename>
+ must be rebuilt...
+ This won't cause any actual build problems--both
+ builds will succeed,
+ generate correct output files,
+ and populate the cache--but
+ it does represent wasted effort.
+
+ </para>
+
+ <para>
+
+ To alleviate such contention for the cache,
+ you can use the <literal>--random</literal> command-line option
+ to tell &SCons; to build dependencies
+ in a random order:
+
+ </para>
+
+ <!--
+
+ The following <screen> output was generated by this:
+
+ <scons_output example="ex-random">
+ <scons_output_command>scons -Q - -random</scons_output_command>
+ </scons_output>
+
+ We captured it directly here to guarantee a "random" order,
+ guarding against the potential for - -random to happen
+ to return things in the original sorted order.
+
+ -->
+
+ <screen>
+ % <userinput>scons -Q --random</userinput>
+ cc -o f3.o -c f3.c
+ cc -o f1.o -c f1.c
+ cc -o f5.o -c f5.c
+ cc -o f2.o -c f2.c
+ cc -o f4.o -c f4.c
+ cc -o prog f1.o f2.o f3.o f4.o f5.o
+ </screen>
+
+ <para>
+
+ Multiple builds using the <literal>--random</literal> option
+ will usually build their dependencies in different,
+ random orders,
+ which minimizes the chances for a lot of
+ contention for same-named files
+ in the shared cache directory.
+ Multiple simultaneous builds might still race to try to build
+ the same target file on occasion,
+ but long sequences of inefficient contention
+ should be rare.
+
+ </para>
+
+ <para>
+
+ Note, of course,
+ the <literal>--random</literal> option
+ will cause the output that &SCons; prints
+ to be inconsistent from invocation to invocation,
+ which may be an issue when
+ trying to compare output from different build runs.
+
+ </para>
+
+ </section>
+
+ <!--
+
+ <section>
+ <title>Troubleshooting Shared Caching: the &cache-debug; Option</title>
+
+ <para>
+
+ XXX describe the - - cache-debug option
+ XXX maybe point to the troubleshooting appendix?
+
+ </para>
+
+ </section>
+
+ -->
+
+ <!--
+
+ <section>
+
+ <para>
+
+ XXX describe CacheDir management: monitoring, deleting, etc.
+
+ </para>
+
+ </section>
+
+ -->
<screen>
% <userinput>scons -Q</userinput>
- cc -o bar.o -c -D['RELEASE_BUILD=', 1] bar.c
- cc -o foo.o -c -D['RELEASE_BUILD=', 1] foo.c
+ cc -o bar.o -c -DRELEASE_BUILD=1 bar.c
+ cc -o foo.o -c -DRELEASE_BUILD=1 foo.c
cc -o foo foo.o bar.o
</screen>
<screen>
% <userinput>scons -Q</userinput>
- cc -o bar.o -c -D['RELEASE_BUILD=', 0] bar.c
- cc -o foo.o -c -D['RELEASE_BUILD=', 0] foo.c
+ cc -o bar.o -c -DRELEASE_BUILD=0 bar.c
+ cc -o foo.o -c -DRELEASE_BUILD=0 foo.c
cc -o foo foo.o bar.o
</screen>
<screen>
% <userinput>scons -Q RELEASE=yes foo.o</userinput>
- cc -o foo.o -c -D['RELEASE_BUILD=', True] foo.c
+ cc -o foo.o -c -DRELEASE_BUILD=True foo.c
</screen>
<screen>
% <userinput>scons -Q RELEASE=t foo.o</userinput>
- cc -o foo.o -c -D['RELEASE_BUILD=', True] foo.c
+ cc -o foo.o -c -DRELEASE_BUILD=True foo.c
</screen>
<para>
<screen>
% <userinput>scons -Q RELEASE=no foo.o</userinput>
- cc -o foo.o -c -D['RELEASE_BUILD=', False] foo.c
+ cc -o foo.o -c -DRELEASE_BUILD=False foo.c
</screen>
<screen>
% <userinput>scons -Q RELEASE=f foo.o</userinput>
- cc -o foo.o -c -D['RELEASE_BUILD=', False] foo.c
+ cc -o foo.o -c -DRELEASE_BUILD=False foo.c
</screen>
<para>
% <userinput>scons -Q PACKAGE=/usr/local/location foo.o</userinput>
cc -o foo.o -c -DPACKAGE="/usr/local/location" foo.c
% <userinput>scons -Q PACKAGE=yes foo.o</userinput>
- cc -o foo.o -c -D['PACKAGE="', True, '"'] foo.c
+ cc -o foo.o -c -DPACKAGE="True" foo.c
% <userinput>scons -Q PACKAGE=no foo.o</userinput>
- cc -o foo.o -c -D['PACKAGE="', False, '"'] foo.c
+ cc -o foo.o -c -DPACKAGE="False" foo.c
</screen>
</section>
+++ /dev/null
-<!--
-
- __COPYRIGHT__
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
- KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- 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.
-
--->
-
- <para>
-
- XXX
-
- </para>
-
- <section>
- <title>Differences Between &Cons; and &SCons;</title>
-
- <para>
-
- XXX
-
- </para>
-
- </section>
-
- <section>
- <title>Advantages of &SCons; Over &Cons;</title>
-
- <para>
-
- XXX
-
- </para>
-
- </section>
+++ /dev/null
-<!--
-
- __COPYRIGHT__
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
- KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- 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.
-
--->
-
- <para>
-
- XXX
-
- </para>
-
- <section>
- <title>Differences Between &Cons; and &SCons;</title>
-
- <para>
-
- XXX
-
- </para>
-
- </section>
-
- <section>
- <title>Advantages of &SCons; Over &Cons;</title>
-
- <para>
-
- XXX
-
- </para>
-
- </section>
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--->
-
-<!--
-
-=head2 The C<Salt> method
-
-The C<Salt> method adds a constant value to the signature calculation
-for every derived file. It is invoked as follows:
-
- Salt $string;
-
-Changing the Salt value will force a complete rebuild of every derived
-file. This can be used to force rebuilds in certain desired
-circumstances. For example,
-
- Salt `uname -s`;
-
-Would force a complete rebuild of every derived file whenever the
-operating system on which the build is performed (as reported by C<uname
--s>) changes.
-
-->
<para>
<para>
As you've just seen,
- &SCons; uses signatures to decide whether a
+ &SCons; uses signatures to decide whether a
target file is up to date or must be rebuilt.
When a target file depends on another target file,
&SCons; allows you to configure separately
<para>
- The &cv-CPPPATH; value
+ The &cv-link-CPPPATH; value
tells &SCons; to look in the current directory
(<literal>'.'</literal>)
for any files included by C source files
<para>
- Like the &cv-LIBPATH; variable,
+ Like the &cv-link-LIBPATH; variable,
the &cv-CPPPATH; variable
may be a list of directories,
or a string separated by
SetOption('implicit_cache', 1)
</sconstruct>
- <!--
-
<para>
-
- XXX
- </para>
+ &SCons; does not cache implicit dependencies like this by default
+ because the &implicit-cache; causes &SCons; to simply use the implicit
+ dependencies stored during the last run, without any checking
+ for whether or not those dependencies are still correct.
+ Specifically, this means &implicit-cache; instructs &SCons;
+ to <emphasis>not</emphasis> rebuild "correctly" in the
+ following cases:
- <para>
- &SCons; does not cache implicit dependencies like this by default
- because XXX
-
</para>
- -->
+ <itemizedlist>
+
+ <listitem>
+ <para>
+
+ When &implicit-cache; is used, &SCons; will ignore any changes that
+ may have been made to search paths
+ (like &cv-CPPPATH; or &cv-LIBPATH;,).
+ This can lead to &SCons; not rebuilding a file if a change to
+ &cv-CPPPATH; would normally cause a different, same-named file from
+ a different directory to be used.
+
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+
+ When &implicit-cache; is used, &SCons; will not detect if a
+ same-named file has been added to a directory that is earlier in
+ the search path than the directory in which the file was found
+ last time.
+
+ </para>
+ </listitem>
+
+ </itemizedlist>
<section>
<title>The &implicit-deps-changed; Option</title>
and re-scans the file for any updated
implicit dependency information.
Sometimes, however, you may want
- to force &SCons; to use the cached implicit dependencies,
+ to force &SCons; to use the cached implicit dependencies,
even if the source files changed.
This can speed up a build for example,
when you have changed your source files
</section>
+ <!--
+
+ <section>
+ <title>XXX max drift</title>
+
+ XXX SetOption('max_drift')
+
+ </section>
+
+ -->
+
</section>
<section>
<para>
- Sometimes it makes sense
+ Sometimes it makes sense
to not rebuild a program,
even if a dependency file changes.
In this case,
Ignore(hello, 'hello.h')
</file>
<file name="hello.c">
- #include "hello.h"
+ #include "hello.h"
int main() { printf("Hello, %s!\n", string); }
</file>
<file name="hello.h">
</section>
- <!-->
+ <section>
+ <title>The &AlwaysBuild; Method</title>
+
+ <para>
+
+ How &SCons; handles dependencies can also be affected
+ by the &AlwaysBuild; method.
+ When a file is passed to the &AlwaysBuild; method,
+ like so:
+
+ </para>
+
+ <scons_example name="AlwaysBuild">
+ <file name="SConstruct" printme="1">
+ hello = Program('hello.c')
+ AlwaysBuild(hello)
+ </file>
+ <file name="hello.c">
+ int main() { printf("Hello, %s!\n", string); }
+ </file>
+ </scons_example>
+
+ <para>
+
+ Then the specified target file (&hello; in our example)
+ will always be considered out-of-date and
+ rebuilt whenever that target file is evaluated
+ while walking the dependency graph:
+
+ </para>
+
+ <scons_output example="AlwaysBuild">
+ <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ The &AlwaysBuild; function has a somewhat misleading name,
+ because it does not actually mean the target file will
+ be rebuilt every single time &SCons; is invoked.
+ Instead, it means that the target will, in fact,
+ be rebuilt whenever the target file is encountered
+ while evaluating the targets specified on
+ the command line (and their dependencies).
+ So specifying some other target on the command line,
+ a target that does <emphasis>not</emphasis>
+ itself depend on the &AlwaysBuild; target,
+ will still be rebuilt only if it's out-of-date
+ with respect to its dependencies:
+
+ </para>
+
+ <scons_output example="AlwaysBuild">
+ <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q hello.o</scons_output_command>
+ </scons_output>
+
+ <!--
+
+ XXX AlwaysBuild() and Alias Nodes
+
+ XXX AlwaysBuild() and Dir Nodes
+
+ XXX AlwaysBuild() with no sources
+
+ -->
+
+ </section>
+
+ <!--
<section>
<title>The &Salt; Method</title>
<para>
- XXX
+ XXX Salt() (are we going to implement this ?)
+
+ original Cons classic POD documentation:
+
+=head2 The C<Salt> method
+
+The C<Salt> method adds a constant value to the signature calculation
+for every derived file. It is invoked as follows:
+
+ Salt $string;
+
+Changing the Salt value will force a complete rebuild of every derived
+file. This can be used to force rebuilds in certain desired
+circumstances. For example,
+
+ Salt `uname -s`;
+
+Would force a complete rebuild of every derived file whenever the
+operating system on which the build is performed (as reported by C<uname
+-s>) changes.
</para>
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--->
-
-<!--
-
-=head2 The C<Salt> method
-
-The C<Salt> method adds a constant value to the signature calculation
-for every derived file. It is invoked as follows:
-
- Salt $string;
-
-Changing the Salt value will force a complete rebuild of every derived
-file. This can be used to force rebuilds in certain desired
-circumstances. For example,
-
- Salt `uname -s`;
-
-Would force a complete rebuild of every derived file whenever the
-operating system on which the build is performed (as reported by C<uname
--s>) changes.
-
-->
<para>
<para>
As you've just seen,
- &SCons; uses signatures to decide whether a
+ &SCons; uses signatures to decide whether a
target file is up to date or must be rebuilt.
When a target file depends on another target file,
&SCons; allows you to configure separately
<para>
- The &cv-CPPPATH; value
+ The &cv-link-CPPPATH; value
tells &SCons; to look in the current directory
(<literal>'.'</literal>)
for any files included by C source files
<para>
- Like the &cv-LIBPATH; variable,
+ Like the &cv-link-LIBPATH; variable,
the &cv-CPPPATH; variable
may be a list of directories,
or a string separated by
SetOption('implicit_cache', 1)
</programlisting>
- <!--
-
<para>
-
- XXX
- </para>
+ &SCons; does not cache implicit dependencies like this by default
+ because the &implicit-cache; causes &SCons; to simply use the implicit
+ dependencies stored during the last run, without any checking
+ for whether or not those dependencies are still correct.
+ Specifically, this means &implicit-cache; instructs &SCons;
+ to <emphasis>not</emphasis> rebuild "correctly" in the
+ following cases:
- <para>
- &SCons; does not cache implicit dependencies like this by default
- because XXX
-
</para>
- -->
+ <itemizedlist>
+
+ <listitem>
+ <para>
+
+ When &implicit-cache; is used, &SCons; will ignore any changes that
+ may have been made to search paths
+ (like &cv-CPPPATH; or &cv-LIBPATH;,).
+ This can lead to &SCons; not rebuilding a file if a change to
+ &cv-CPPPATH; would normally cause a different, same-named file from
+ a different directory to be used.
+
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+
+ When &implicit-cache; is used, &SCons; will not detect if a
+ same-named file has been added to a directory that is earlier in
+ the search path than the directory in which the file was found
+ last time.
+
+ </para>
+ </listitem>
+
+ </itemizedlist>
<section>
<title>The &implicit-deps-changed; Option</title>
and re-scans the file for any updated
implicit dependency information.
Sometimes, however, you may want
- to force &SCons; to use the cached implicit dependencies,
+ to force &SCons; to use the cached implicit dependencies,
even if the source files changed.
This can speed up a build for example,
when you have changed your source files
</section>
+ <!--
+
+ <section>
+ <title>XXX max drift</title>
+
+ XXX SetOption('max_drift')
+
+ </section>
+
+ -->
+
</section>
<section>
<para>
- Sometimes it makes sense
+ Sometimes it makes sense
to not rebuild a program,
even if a dependency file changes.
In this case,
</section>
- <!-->
+ <section>
+ <title>The &AlwaysBuild; Method</title>
+
+ <para>
+
+ How &SCons; handles dependencies can also be affected
+ by the &AlwaysBuild; method.
+ When a file is passed to the &AlwaysBuild; method,
+ like so:
+
+ </para>
+
+ <programlisting>
+ hello = Program('hello.c')
+ AlwaysBuild(hello)
+ </programlisting>
+
+ <para>
+
+ Then the specified target file (&hello; in our example)
+ will always be considered out-of-date and
+ rebuilt whenever that target file is evaluated
+ while walking the dependency graph:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ cc -o hello.o -c hello.c
+ cc -o hello hello.o
+ % <userinput>scons -Q</userinput>
+ cc -o hello hello.o
+ </screen>
+
+ <para>
+
+ The &AlwaysBuild; function has a somewhat misleading name,
+ because it does not actually mean the target file will
+ be rebuilt every single time &SCons; is invoked.
+ Instead, it means that the target will, in fact,
+ be rebuilt whenever the target file is encountered
+ while evaluating the targets specified on
+ the command line (and their dependencies).
+ So specifying some other target on the command line,
+ a target that does <emphasis>not</emphasis>
+ itself depend on the &AlwaysBuild; target,
+ will still be rebuilt only if it's out-of-date
+ with respect to its dependencies:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ cc -o hello.o -c hello.c
+ cc -o hello hello.o
+ % <userinput>scons -Q hello.o</userinput>
+ scons: `hello.o' is up to date.
+ </screen>
+
+ <!--
+
+ XXX AlwaysBuild() and Alias Nodes
+
+ XXX AlwaysBuild() and Dir Nodes
+
+ XXX AlwaysBuild() with no sources
+
+ -->
+
+ </section>
+
+ <!--
<section>
<title>The &Salt; Method</title>
<para>
- XXX
+ XXX Salt() (are we going to implement this ?)
+
+ original Cons classic POD documentation:
+
+=head2 The C<Salt> method
+
+The C<Salt> method adds a constant value to the signature calculation
+for every derived file. It is invoked as follows:
+
+ Salt $string;
+
+Changing the Salt value will force a complete rebuild of every derived
+file. This can be used to force rebuilds in certain desired
+circumstances. For example,
+
+ Salt `uname -s`;
+
+Would force a complete rebuild of every derived file whenever the
+operating system on which the build is performed (as reported by C<uname
+-s>) changes.
</para>
=back
-XXX
-
-DESCRIBE THE Literal() FUNCTION, TOO
-
-XXX
+XXX DESCRIBE THE Literal() FUNCTION, TOO XXX
=head2 Expanding construction variables in file names
</scons_example>
<para>
-
+
The construction environment in this example
is still initialized with the same default
construction variable values,
</section>
+ <!--
+
+ <section>
+ <title>Setting Values Only If They're Not Already Defined</title>
+
+ <para>
+
+ XXX SetDefault()
+
+ </para>
+
+ </section>
+
+ -->
+
<section>
<title>Appending to the End of Values in a &ConsEnv;</title>
<scons_output_command>scons -Q</scons_output_command>
</scons_output>
+ <!--
+
+ XXX AppendUnique()
+
+ -->
+
</section>
<section>
<para>
- You can append a value to the beginning
+ You can append a value to the beginning of
an existing construction variable
using the &Prepend; method:
<scons_output_command>scons -Q</scons_output_command>
</scons_output>
+ <!--
+
+ XXX PrependUnique()
+
+ -->
+
+ </section>
+
+ <!--
+
+ <section>
+ <title>Adding to Values in the Execution Environment</title>
+
+ <para>
+
+ XXX AppendENVPath()
+
+ XXX PrependENVPath()
+
+ </para>
+
</section>
+ -->
+
</section>
=back
-XXX
-
-DESCRIBE THE Literal() FUNCTION, TOO
-
-XXX
+XXX DESCRIBE THE Literal() FUNCTION, TOO XXX
=head2 Expanding construction variables in file names
</programlisting>
<para>
-
+
The construction environment in this example
is still initialized with the same default
construction variable values,
</section>
+ <!--
+
+ <section>
+ <title>Setting Values Only If They're Not Already Defined</title>
+
+ <para>
+
+ XXX SetDefault()
+
+ </para>
+
+ </section>
+
+ -->
+
<section>
<title>Appending to the End of Values in a &ConsEnv;</title>
scons: `.' is up to date.
</screen>
+ <!--
+
+ XXX AppendUnique()
+
+ -->
+
</section>
<section>
<para>
- You can append a value to the beginning
+ You can append a value to the beginning of
an existing construction variable
using the &Prepend; method:
scons: `.' is up to date.
</screen>
+ <!--
+
+ XXX PrependUnique()
+
+ -->
+
+ </section>
+
+ <!--
+
+ <section>
+ <title>Adding to Values in the Execution Environment</title>
+
+ <para>
+
+ XXX AppendENVPath()
+
+ XXX PrependENVPath()
+
+ </para>
+
</section>
+ -->
+
</section>
<para>
Notice that the action returned by the &Copy; factory
- will expand the &cv-TARGET; and &cv-SOURCE; strings
+ will expand the &cv-link-TARGET; and &cv-link-SOURCE; strings
at the time &file_out; is built,
and that the order of the arguments
is the same as that of a builder itself--that is,
Of course, like all of these &Action; factories,
the &Delete factory also expands
- &cv-TARGET; and &cv-SOURCE; variables appropriately.
+ &cv-link-TARGET; and &cv-link-SOURCE; variables appropriately.
For example:
</para>
<para>
Notice that the action returned by the &Copy; factory
- will expand the &cv-TARGET; and &cv-SOURCE; strings
+ will expand the &cv-link-TARGET; and &cv-link-SOURCE; strings
at the time &file_out; is built,
and that the order of the arguments
is the same as that of a builder itself--that is,
Of course, like all of these &Action; factories,
the &Delete; factory also expands
- &cv-TARGET; and &cv-SOURCE; variables appropriately.
+ &cv-link-TARGET; and &cv-link-SOURCE; variables appropriately.
For example:
</para>
There are two occasions when &SCons; will,
by default, remove target files.
- The first is when &SCons; determines that
+ The first is when &SCons; determines that
an target file needs to be rebuilt
and removes the existing version of the target
before executing
<title>Preventing target removal during build: the &Precious; Function</title>
<para>
-
+
By default, &SCons; removes targets before building them.
Sometimes, however, this is not what you want.
For example, you may want to update a library incrementally,
In such cases, you can use the
&Precious; method to prevent
&SCons; from removing the target before it is built:
-
+
</para>
-
+
<scons_example name="precious-ex1">
<file name="SConstruct" printme="1">
env = Environment(RANLIBCOM='')
int f3() { }
</file>
</scons_example>
-
+
<para>
-
+
Although the output doesn't look any different,
&SCons; does not, in fact,
delete the target library before rebuilding it:
-
+
</para>
-
+
<scons_output example="precious-ex1">
<scons_output_command>scons -Q</scons_output_command>
</scons_output>
-
+
<para>
-
+
&SCons; will, however, still delete files marked as &Precious;
when the <literal>-c</literal> option is used.
-
+
</para>
</section>
-
<section>
<title>Preventing target removal during clean: the &NoClean; Function</title>
<para>
-
+
By default, &SCons; removes all built targets when invoked
with the <literal>-c</literal> option to clean a source tree
of built tragets.
but leave the final targets
(the libraries)
untouched.
-
+
In such cases, you can use the &NoClean; method to prevent &SCons;
from removing a target during a clean:
-
+
</para>
-
+
<scons_example name="noclean-ex1">
<file name="SConstruct" printme="1">
env = Environment(RANLIBCOM='')
int f3() { }
</file>
</scons_example>
-
+
<para>
-
+
Notice that the <filename>libfoo.a</filename>
is not listed as a removed file:
-
+
</para>
-
+
<scons_output example="noclean-ex1">
<scons_output_command>scons -Q</scons_output_command>
<scons_output_command>scons -c</scons_output_command>
</section>
+ <section>
+ <title>Removing additional files during clean: the &Clean; Function</title>
+
+ <para>
+
+ There may be additional files that you want removed
+ when the <literal>-c</literal> option is used,
+ but which &SCons; doesn't know about
+ because they're not normal target files.
+ For example, perhaps a command you invoke
+ creates a log file as
+ part of building the target file you want.
+ You would like the log file cleaned,
+ but you don't want to have to teach
+ SCons that the command
+ "builds" two files.
+
+ </para>
+
+ <para>
+
+ You can use the &Clean; function to arrange for additional files
+ to be removed when the <literal>-c</literal> option is used.
+ Notice, however, that the &Clean; function takes two arguments,
+ and the <emphasis>second</emphasis> argument
+ is the name of the additional file you want cleaned
+ (<filename>foo.log</filename> in this example):
+
+ </para>
+
+ <scons_example name="clean-ex1">
+ <file name="S" printme="1">
+ t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE')
+ Clean(t, 'foo.log')
+ </file>
+ <file name="SConstruct">
+ env = DefaultEnvironment()
+ import os
+ env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd()
+ SConscript('S')
+ </file>
+ <file name="foo.in">
+ foo.in
+ </file>
+ <file name="foo.log">
+ foo.log
+ </file>
+ <file name="build" chmod="0755">
+ cat $3 > $2
+ </file>
+ </scons_example>
+
+ <para>
+
+ The first argument is the target with which you want
+ the cleaning of this additional file associated.
+ In the above example,
+ we've used the return value from the
+ &Command; function,
+ which represents the
+ <filename>foo.out</filename>
+ target.
+ Now whenever the
+ <filename>foo.out</filename> target is cleaned
+ by the <literal>-c</literal> option,
+ the <filename>foo.log</filename> file
+ will be removed as well:
+
+ </para>
+
+ <scons_output example="clean-ex1">
+ <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q -c</scons_output_command>
+ </scons_output>
+
+ </section>
There are two occasions when &SCons; will,
by default, remove target files.
- The first is when &SCons; determines that
+ The first is when &SCons; determines that
an target file needs to be rebuilt
and removes the existing version of the target
before executing
<title>Preventing target removal during build: the &Precious; Function</title>
<para>
-
+
By default, &SCons; removes targets before building them.
Sometimes, however, this is not what you want.
For example, you may want to update a library incrementally,
In such cases, you can use the
&Precious; method to prevent
&SCons; from removing the target before it is built:
-
+
</para>
-
+
<programlisting>
env = Environment(RANLIBCOM='')
lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
env.Precious(lib)
</programlisting>
-
+
<para>
-
+
Although the output doesn't look any different,
&SCons; does not, in fact,
delete the target library before rebuilding it:
-
+
</para>
-
+
<screen>
% <userinput>scons -Q</userinput>
cc -o f1.o -c f1.c
cc -o f3.o -c f3.c
ar rc libfoo.a f1.o f2.o f3.o
</screen>
-
+
<para>
-
+
&SCons; will, however, still delete files marked as &Precious;
when the <literal>-c</literal> option is used.
-
+
</para>
</section>
-
<section>
<title>Preventing target removal during clean: the &NoClean; Function</title>
<para>
-
+
By default, &SCons; removes all built targets when invoked
with the <literal>-c</literal> option to clean a source tree
of built tragets.
but leave the final targets
(the libraries)
untouched.
-
+
In such cases, you can use the &NoClean; method to prevent &SCons;
from removing a target during a clean:
-
+
</para>
-
+
<programlisting>
env = Environment(RANLIBCOM='')
lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
env.NoClean(lib)
</programlisting>
-
+
<para>
-
+
Notice that the <filename>libfoo.a</filename>
is not listed as a removed file:
-
+
</para>
-
+
<screen>
% <userinput>scons -Q</userinput>
cc -o f1.o -c f1.c
</section>
+ <section>
+ <title>Removing additional files during clean: the &Clean; Function</title>
+
+ <para>
+
+ There may be additional files that you want removed
+ when the <literal>-c</literal> option is used,
+ but which &SCons; doesn't know about
+ because they're not normal target files.
+ For example, perhaps a command you invoke
+ creates a log file as
+ part of building the target file you want.
+ You would like the log file cleaned,
+ but you don't want to have to teach
+ SCons that the command
+ "builds" two files.
+
+ </para>
+
+ <para>
+
+ You can use the &Clean; function to arrange for additional files
+ to be removed when the <literal>-c</literal> option is used.
+ Notice, however, that the &Clean; function takes two arguments,
+ and the <emphasis>second</emphasis> argument
+ is the name of the additional file you want cleaned
+ (<filename>foo.log</filename> in this example):
+
+ </para>
+
+ <programlisting>
+ t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE')
+ Clean(t, 'foo.log')
+ </programlisting>
+
+ <para>
+
+ The first argument is the target with which you want
+ the cleaning of this additional file associated.
+ In the above example,
+ we've used the return value from the
+ &Command; function,
+ which represents the
+ <filename>foo.out</filename>
+ target.
+ Now whenever the
+ <filename>foo.out</filename> target is cleaned
+ by the <literal>-c</literal> option,
+ the <filename>foo.log</filename> file
+ will be removed as well:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ build -o foo.out foo.in
+ % <userinput>scons -Q -c</userinput>
+ Removed foo.out
+ Removed foo.log
+ </screen>
+
+ </section>
(Notice that the <literal>lib/foo1.o</literal> object file
is built in the same directory as its source file.
See <xref linkend="chap-separate">, below,
- for information about
+ for information about
how to build the object file in a different subdirectory.)
</para>
notice that the <literal>/usr/joe/lib/foo1.o</literal> object file
is built in the same directory as its source file.
See <xref linkend="chap-separate">, below,
- for information about
+ for information about
how to build the object file in a different subdirectory.)
</para>
</section>
</section>
+
+ <!--
+
+ <section>
+ <title>Executing From a Subdirectory: the -D, -u and -U Options</title>
+
+ <para>
+
+ XXX -D, -u and -U
+
+ </para>
+
+ </section>
+
+ -->
(Notice that the <literal>lib/foo1.o</literal> object file
is built in the same directory as its source file.
See <xref linkend="chap-separate">, below,
- for information about
+ for information about
how to build the object file in a different subdirectory.)
</para>
notice that the <literal>/usr/joe/lib/foo1.o</literal> object file
is built in the same directory as its source file.
See <xref linkend="chap-separate">, below,
- for information about
+ for information about
how to build the object file in a different subdirectory.)
</para>
</section>
</section>
+
+ <!--
+
+ <section>
+ <title>Executing From a Subdirectory: the -D, -u and -U Options</title>
+
+ <para>
+
+ XXX -D, -u and -U
+
+ </para>
+
+ </section>
+
+ -->
<!ENTITY builders-writing SYSTEM "builders-writing.sgml">
<!ENTITY caching SYSTEM "caching.sgml">
<!ENTITY command-line SYSTEM "command-line.sgml">
- <!ENTITY cons SYSTEM "cons.sgml">
<!ENTITY copyright SYSTEM "copyright.sgml">
<!ENTITY depends SYSTEM "depends.sgml">
<!ENTITY ENV_file SYSTEM "ENV.sgml">
]>
+ <!--
+
+ XXX AllowSubstExceptions()
+ XXX EnsurePythonVersion()
+ XXX EnsureSConsVersion()
+ XXX Exit()
+ XXX FindFile()
+ XXX FindPathDirs()
+ XXX Flatten()
+ XXX GetBuildPath()
+ XXX GetLaunchDir()
+
+ XXX MergeFlags()
+ XXX ParseFlags()
+
+ XXX ParseDepends()
+ XXX Platform()
+ XXX SConsignFile()
+ XXX SideEffect()
+ XXX Tools()
+
+ XXX GetOption('clean')
+ XXX SetOption('clean')
+
+ XXX GetOption('duplicate')
+ XXX SetOption('duplicate')
+ XXX - - duplicate=
+
+ XXX GetOption('num_jobs')
+ XXX SetOption('num_jobs')
+
+ XXX - - diskcheck=
+
+ XXX site_scons
+ XXX - - site-dir
+ XXX - - no-site-dir
+
+ XXX - - warn=
+
+ XXX ARGLIST
+ XXX ARGUMENTS
+ XXX BUILD_TARGETS
+ XXX COMMAND_LINE_TARGETS
+ XXX DEFAULT_TARGETS
+
+ -->
+
<book>
<bookinfo>
<title>SCons User Guide &buildversion;</title>
<!--
+ XXX Action()
+ XXX AddPostAction()
+ XXX AddPreAction()
+
<chapter id="chap-actions">
<title>&SCons; Actions</title>
&actions;
&troubleshoot;
</chapter>
- <!--
- AddPostAction()
- AddPreAction()
- Clean()
- Dir()
- File()
- FindFile()
- GetJobs()
- SetJobs()
- SideEffect()
- ParseConfig()
- Platform()
- Tools()
- -->
-
<appendix id="app-variables">
<title>Construction Variables</title>
&variables;
<!ENTITY builders-writing SYSTEM "builders-writing.sgml">
<!ENTITY caching SYSTEM "caching.sgml">
<!ENTITY command-line SYSTEM "command-line.sgml">
- <!ENTITY cons SYSTEM "cons.sgml">
<!ENTITY copyright SYSTEM "copyright.sgml">
<!ENTITY depends SYSTEM "depends.sgml">
<!ENTITY ENV_file SYSTEM "ENV.sgml">
]>
+ <!--
+
+ XXX AllowSubstExceptions()
+ XXX EnsurePythonVersion()
+ XXX EnsureSConsVersion()
+ XXX Exit()
+ XXX FindFile()
+ XXX FindPathDirs()
+ XXX Flatten()
+ XXX GetBuildPath()
+ XXX GetLaunchDir()
+
+ XXX MergeFlags()
+ XXX ParseFlags()
+
+ XXX ParseDepends()
+ XXX Platform()
+ XXX SConsignFile()
+ XXX SideEffect()
+ XXX Tools()
+
+ XXX GetOption('clean')
+ XXX SetOption('clean')
+
+ XXX GetOption('duplicate')
+ XXX SetOption('duplicate')
+ XXX - - duplicate=
+
+ XXX GetOption('num_jobs')
+ XXX SetOption('num_jobs')
+
+ XXX - - diskcheck=
+
+ XXX site_scons
+ XXX - - site-dir
+ XXX - - no-site-dir
+
+ XXX - - warn=
+
+ XXX ARGLIST
+ XXX ARGUMENTS
+ XXX BUILD_TARGETS
+ XXX COMMAND_LINE_TARGETS
+ XXX DEFAULT_TARGETS
+
+ -->
+
<book>
<bookinfo>
<title>SCons User Guide &buildversion;</title>
<!--
+ XXX Action()
+ XXX AddPostAction()
+ XXX AddPreAction()
+
<chapter id="chap-actions">
<title>&SCons; Actions</title>
&actions;
&troubleshoot;
</chapter>
- <!--
- AddPostAction()
- AddPreAction()
- Clean()
- Dir()
- File()
- FindFile()
- GetJobs()
- SetJobs()
- SideEffect()
- ParseConfig()
- Platform()
- Tools()
- -->
-
<appendix id="app-variables">
<title>Construction Variables</title>
&variables;
</section>
-->
+
+ <!--
+
+ <section>
+ <title>Python Value &Node;</title>
+
+ <para>
+
+ XXX Value()
+
+ </para>
+
+ </section>
+
+ -->
</section>
-->
+
+ <!--
+
+ <section>
+ <title>Python Value &Node;</title>
+
+ <para>
+
+ XXX Value()
+
+ </para>
+
+ </section>
+
+ -->
<para>
- XXX
+ XXX history of SCons
</para>
<para>
- XXX
+ XXX conventions used in this manual
</para>
<para>
- XXX
+ XXX history of SCons
</para>
<para>
- XXX
+ XXX conventions used in this manual
</para>
found in the local build tree,
&SCons; will search first for
a <filename>/usr/repository1/hello.c</filename> file
- and then for a <filename>/usr/repository1/hello.c</filename> file
+ and then for a <filename>/usr/repository2/hello.c</filename> file
to use in its place.
</para>
a source file for <literal>#include</literal> file names
and realize that targets built from that source file
also depend on the <literal>#include</literal> file(s).
- For each directory in the &cv-CPPPATH; list,
+ For each directory in the &cv-link-CPPPATH; list,
&SCons; will actually search the corresponding directories
in any repository trees and establish the
correct dependencies on any
Some modern versions of C compilers do have an option
to disable or control this behavior.
- If so, add that option to &cv-CFLAGS;
- (or &cv-CXXFLAGS; or both) in your construction environment(s).
+ If so, add that option to &cv-link-CFLAGS;
+ (or &cv-link-CXXFLAGS; or both) in your construction environment(s).
Make sure the option is used for all construction
environments that use C preprocessing!
found in the local build tree,
&SCons; will search first for
a <filename>/usr/repository1/hello.c</filename> file
- and then for a <filename>/usr/repository1/hello.c</filename> file
+ and then for a <filename>/usr/repository2/hello.c</filename> file
to use in its place.
</para>
a source file for <literal>#include</literal> file names
and realize that targets built from that source file
also depend on the <literal>#include</literal> file(s).
- For each directory in the &cv-CPPPATH; list,
+ For each directory in the &cv-link-CPPPATH; list,
&SCons; will actually search the corresponding directories
in any repository trees and establish the
correct dependencies on any
Some modern versions of C compilers do have an option
to disable or control this behavior.
- If so, add that option to &cv-CFLAGS;
- (or &cv-CXXFLAGS; or both) in your construction environment(s).
+ If so, add that option to &cv-link-CFLAGS;
+ (or &cv-link-CXXFLAGS; or both) in your construction environment(s).
Make sure the option is used for all construction
environments that use C preprocessing!
</screen>
</section>
+
+ <!--
+
+ <section>
+ <title>Controlling Configuration: the &config; Option</title>
+
+ <para>
+
+ XXX -D, -u and -U
+
+ </para>
+
+ </section>
+
+ -->
</screen>
</section>
+
+ <!--
+
+ <section>
+ <title>Controlling Configuration: the &config; Option</title>
+
+ <para>
+
+ XXX -D, -u and -U
+
+ </para>
+
+ </section>
+
+ -->
</para>
- </section>
+ </section>
<section>
<title>Telling &SCons; to Not Duplicate Source Files in the Build Directory</title>
<title>Why You'd Want to Call &BuildDir; Instead of &SConscript;</title>
<para>
-
- XXX
+
+ XXX why call BuildDir() instead of SConscript(build_dir=)
</para>
</para>
- </section>
+ </section>
<section>
<title>Telling &SCons; to Not Duplicate Source Files in the Build Directory</title>
<title>Why You'd Want to Call &BuildDir; Instead of &SConscript;</title>
<para>
-
- XXX
+
+ XXX why call BuildDir() instead of SConscript(build_dir=)
</para>
<para>
This appendix contains descriptions of all of the
-Tools that are
+Tools modules that are
available "out of the box" in this version of SCons.
</para>
<para>
This appendix contains descriptions of all of the
-Tools that are
+Tools modules that are
available "out of the box" in this version of SCons.
</para>
the tool is behaving a certain way,
and how to get it to behave the way you want.
&SCons; is no different.
+ This appendix contains a number of
+ different ways in which you can
+ get some additional insight into &SCons' behavior.
+
+ </para>
+
+ <para>
+
+ Note that we're always interested in trying to
+ improve how you can troubleshoot configuration problems.
+ If you run into a problem that has
+ you scratching your head,
+ and which there just doesn't seem to be a good way to debug,
+ odds are pretty good that someone else will run into
+ the same problem, too.
+ If so, please let the SCons development team know
+ (preferably by filing a bug report
+ or feature request at our project pages at tigris.org)
+ so that we can use your feedback
+ to try to come up with a better way to help you,
+ and others, get the necessary insight into &SCons; behavior
+ to help identify and fix configuration issues.
</para>
<para>
- Let's take a simple example of
+ Let's look at a simple example of
a misconfigured build
that causes a target to be rebuilt
every time &SCons; is run:
<para>
- Now if we run &SCons; multiple on this example,
+ Now if we run &SCons; multiple times on this example,
we see that it re-runs the &cp;
command every time:
<scons_output_command>scons -Q --debug=explain</scons_output_command>
</scons_output>
+ <para>
+
+ (Note that the &debug-explain; option will only tell you
+ why &SCons; decided to rebuild necessary targets.
+ It does not tell you what files it examined
+ when deciding <emphasis>not</emphasis>
+ to rebuild a target file,
+ which is often a more valuable question to answer.)
+
+ </para>
+
</section>
<section>
</para>
<scons_example name="Dump">
- <file name="SConstruct" print="1">
+ <file name="SConstruct" printme="1">
env = Environment()
print env.Dump()
</file>
</para>
<scons_example name="Dump_ENV">
- <file name="SConstruct" print="1">
+ <file name="SConstruct" printme="1">
env = Environment()
print env.Dump('ENV')
</file>
</scons_output>
</section>
+
+ <section>
+
+ <title>What Dependencies Does &SCons; Know About? the &tree; Option</title>
+
+ <para>
+
+ Sometimes the best way to try to figure out what
+ &SCons; is doing is simply to take a look at the
+ dependency graph that it constructs
+ based on your &SConscript; files.
+ The <literal>--tree</literal> option
+ will display all or part of the
+ &SCons; dependency graph in an
+ "ASCII art" graphical format
+ that shows the dependency hierarchy.
+
+ </para>
+
+ <para>
+
+ For example, given the following input &SConstruct; file:
+
+ </para>
+
+ <scons_example name="tree1">
+ <file name="SConstruct" printme="1">
+ env = Environment(CPPPATH = ['.'])
+ env.Program('prog', ['f1.c', 'f2.c', 'f3.c'])
+ </file>
+ <file name="f1.c">
+ #include "inc.h"
+ </file>
+ <file name="f2.c">
+ #include "inc.h"
+ </file>
+ <file name="f3.c">
+ #include "inc.h"
+ </file>
+ <file name="inc.h">
+ inc.h
+ </file>
+ </scons_example>
+
+ <para>
+
+ Running &SCons; with the <literal>--tree=all</literal>
+ option yields:
+
+ </para>
+
+ <scons_output example="tree1">
+ <scons_output_command>scons -Q --tree=all</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ The tree will also be printed when the
+ <literal>-n</literal> (no execute) option is used,
+ which allows you to examine the dependency graph
+ for a configuration without actually
+ rebuilding anything in the tree.
+
+ </para>
+
+ <para>
+
+ The <literaL>--tree</literal> option only prints
+ the dependency graph for the specified targets
+ (or the default target(s) if none are specified on the command line).
+ So if you specify a target like <filename>f2.o</filename>
+ on the command line,
+ the <literaL>--tree</literal> option will only
+ print the dependency graph for that file:
+
+ </para>
+
+ <scons_output example="tree1">
+ <scons_output_command>scons -Q --tree=all f2.o</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ This is, of course, useful for
+ restricting the output from a very large
+ build configuration to just a
+ portion in which you're interested.
+ Multiple targets are fine,
+ in which case a tree will be printed
+ for each specified target:
+
+ </para>
+
+ <scons_output example="tree1">
+ <scons_output_command>scons -Q --tree=all f1.o f3.o</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ The <literal>status</literal> argument may be used
+ to tell &SCons; to print status information about
+ each file in the dependency graph:
+
+ </para>
+
+ <scons_output example="tree1">
+ <scons_output_command>scons -Q --tree=status</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ Note that <literal>--tree=all,status</literal> is equivalent;
+ the <literal>all</literal>
+ is assumed if only <literal>status</literal> is present.
+ As an alternative to <literal>all</literal>,
+ you can specify <literal>--tree=derived</literal>
+ to have &SCons; only print derived targets
+ in the tree output,
+ skipping source files
+ (like <filename>.c</filename> and <filename>.h</filename> files):
+
+ </para>
+
+ <scons_output example="tree1">
+ <scons_output_command>scons -Q --tree=derived</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ You can use the <literal>status</literal>
+ modifier with <literal>derived</literal> as well:
+
+ </para>
+
+ <scons_output example="tree1">
+ <scons_output_command>scons -Q --tree=derived,status</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ Note that the order of the <literal>--tree=</literal>
+ arguments doesn't matter;
+ <literal>--tree=status,derived</literal> is
+ completely equivalent.
+
+ </para>
+
+ <para>
+
+ The default behavior of the <literal>--tree</literal> option
+ is to repeat all of the dependencies each time the library dependency
+ (or any other dependency file) is encountered in the tree.
+ If certain target files share other target files,
+ such as two programs that use the same library:
+
+ </para>
+
+ <scons_example name="tree2">
+ <file name="SConstruct" printme="1">
+ env = Environment(CPPPATH = ['.'],
+ LIBS = ['foo'],
+ LIBPATH = ['.'])
+ env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
+ env.Program('prog1.c')
+ env.Program('prog2.c')
+ </file>
+ <file name="prog1.c">
+ #include "inc.h"
+ </file>
+ <file name="prog2.c">
+ #include "inc.h"
+ </file>
+ <file name="f1.c">
+ #include "inc.h"
+ </file>
+ <file name="f2.c">
+ #include "inc.h"
+ </file>
+ <file name="f3.c">
+ #include "inc.h"
+ </file>
+ <file name="inc.h">
+ inc.h
+ </file>
+ </scons_example>
+
+ <para>
+
+ Then there can be a <emphasis>lot</emphasis> of repetition in the
+ <literal>--tree=</literal> output:
+
+ </para>
+
+ <scons_output example="tree2">
+ <scons_output_command>scons -Q --tree=all</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ In a large configuration with many internal libraries
+ and include files,
+ this can very quickly lead to huge output trees.
+ To help make this more manageable,
+ a <literal>prune</literal> modifier may
+ be added to the option list,
+ in which case &SCons;
+ will print the name of a target that has
+ already been visited during the tree-printing
+ in <literal>[square brackets]</literal>
+ as an indication that the dependencies
+ of the target file may be found
+ by looking farther up the tree:
+
+ </para>
+
+ <scons_output example="tree2">
+ <scons_output_command>scons -Q --tree=prune</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ Like the <literal>status</literal> keyword,
+ the <literal>prune</literal> argument by itself
+ is equivalent to <literal>--tree=all,prune</literal>.
+
+ </para>
+
+ </section>
+
+ <section>
+
+ <title>How is &SCons; Constructing the Command Lines It Executes? the &debug-presub; Option</title>
+
+ <para>
+
+ Sometimes it's useful to look at the
+ pre-substitution string
+ that &SCons; uses to generate
+ the command lines it executes.
+ This can be done with the &debug-presub; option:
+
+ </para>
+
+ <scons_example name="presub">
+ <file name="SConstruct">
+ env = Environment(CPPPATH = ['.'])
+ env.Program('prog', 'prog.c')
+ </file>
+ <file name="prog.c">
+ prog.c
+ </file>
+ </scons_example>
+
+ <!--
+
+ Have to capture output here, otherwise the - -debug=presub output
+ shows the Python functions from the sconsdoc.py execution wrapper
+ used to generate this manual, not the underlying command-line strings.
+
+ <scons_output example="presub">
+ <scons_output_command>scons -Q - -debug=presub</scons_output_command>
+ </scons_output>
+
+ -->
+
+ <screen>
+ % <userinput>scons -Q --debug=presub</userinput>
+ Building prog.o with action:
+ $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCOMCOM $SOURCES
+ cc -o prog.o -c -I. prog.c
+ Building prog with action:
+ $SMART_LINKCOM
+ cc -o prog prog.o
+ </screen>
+
+ </section>
+
+ <section>
+
+ <title>Where is &SCons; Searching for Libraries? the &debug-findlibs; Option</title>
+
+ <para>
+
+ To get some insight into what library names
+ &SCons; is searching for,
+ and in which directories it is searching,
+ Use the <literal>--debug=findlibs</literal> option.
+ Given the following input &SConstruct; file:
+
+ </para>
+
+ <scons_example name="findlibs">
+ <file name="SConstruct" printme="1">
+ env = Environment(LIBPATH = ['libs1', 'libs2'])
+ env.Program('prog.c', LIBS=['foo', 'bar'])
+ </file>
+ <file name="prog.c">
+ prog.c
+ </file>
+ <file name="libs1/libfoo.a">
+ libs1/libfoo.a
+ </file>
+ <file name="libs2/libbar.a">
+ libs2/libbar.a
+ </file>
+ </scons_example>
+
+ <para>
+
+ And the libraries <filename>libfoo.a</filename>
+ and <filename>libbar.a</filename>
+ in <filename>libs1</filename> and <filename>libs2</filename>,
+ respectively,
+ use of the <literal>--debug=findlibs</literal> option yields:
+
+ </para>
+
+ <scons_output example="findlibs">
+ <scons_output_command>scons -Q --debug=findlibs</scons_output_command>
+ </scons_output>
+
+ </section>
+
+ <!--
+
+ <section>
+
+ <title>What Implicit Dependencies Did the &SCons; Scanner find? the &debug-includes; Option</title>
+
+ <para>
+
+ XXX explain the - - debug=includes option
+
+ </para>
+
+ <scons_example name="includes">
+ <file name="SConstruct" printme="1">
+ env = Environment(CPPPATH = ['inc1', 'inc2'])
+ env.Program('prog.c')
+ </file>
+ <file name="prog.c">
+ #include "file1.h"
+ #include "file2.h"
+ prog.c
+ </file>
+ <file name="inc1/file1.h">
+ inc1/file1.h
+ </file>
+ <file name="inc2/file2.h">
+ inc2/file2.h
+ </file>
+ </scons_example>
+
+ <scons_output example="includes">
+ <scons_output_command>scons -Q - - debug=includes prog</scons_output_command>
+ </scons_output>
+
+ </section>
+
+ -->
+
+ <section>
+
+ <title>Where is &SCons; Blowing Up? the &debug-stacktrace; Option</title>
+
+ <para>
+
+ In general, &SCons; tries to keep its error
+ messages short and informative.
+ That means we usually try to avoid showing
+ the stack traces that are familiar
+ to experienced Python programmers,
+ since they usually contain much more
+ information than is useful to most people.
+
+ </para>
+
+ <para>
+
+ For example, the following &SConstruct file:
+
+ </para>
+
+ <scons_example name="stacktrace">
+ <file name="SConstruct" printme="1">
+ Program('prog.c')
+ </file>
+ </scons_example>
+
+ <para>
+
+ Generates the following error if the
+ <filename>prog.c</filename> file
+ does not exist:
+
+ </para>
+
+ <scons_output example="stacktrace">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ In this case,
+ the error is pretty obvious.
+ But if it weren't,
+ and you wanted to try to get more information
+ about the error,
+ the &debug-stacktrace; option
+ would show you exactly where in the &SCons; source code
+ the problem occurs:
+
+ </para>
+
+ <scons_output example="stacktrace">
+ <scons_output_command>scons -Q --debug=stacktrace</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ Of course, if you do need to dive into the &SCons; source code,
+ we'd like to know if, or how,
+ the error messages or troubleshooting options
+ could have been improved to avoid that.
+ Not everyone has the necessary time or
+ Python skill to dive into the source code,
+ and we'd like to improve &SCons;
+ for those people as well...
+
+ </para>
+
+ </section>
+
+ <section>
+
+ <title>How is &SCons; Making Its Decisions? the &taskmastertrace; Option</title>
+
+ <para>
+
+ The internal &SCons; subsystem that handles walking
+ the dependency graph
+ and controls the decision-making about what to rebuild
+ is the <literal>Taskmaster</literal>.
+ &SCons; supports a <literal>--taskmastertrace</literal>
+ option that tells the Taskmaster to print
+ information about the children (dependencies)
+ of the various Nodes on its walk down the graph,
+ which specific dependent Nodes are being evaluated,
+ and in what order.
+
+ </para>
+
+ <para>
+
+ The <literal>--taskmastertrace</literal> option
+ takes as an argument the name of a file in
+ which to put the trace output,
+ with <filename>-</filename> (a single hyphen)
+ indicating that the trace messages
+ should be printed to the standard output:
+
+ </para>
+
+ <scons_example name="taskmastertrace">
+ <file name="SConstruct" printme="1">
+ env = Environment(CPPPATH = ['.'])
+ env.Program('prog.c')
+ </file>
+ <file name="prog.c">
+ #include "inc.h"
+ prog.c
+ </file>
+ <file name="inc.h">
+ #define STRING "one"
+ </file>
+ </scons_example>
+
+ <scons_output example="taskmastertrace" os="posix">
+ <scons_output_command>scons -Q --taskmastertrace=- prog</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ The <literal>--taskmastertrace</literal> option
+ doesn't provide information about the actual
+ calculations involved in deciding if a file is up-to-date,
+ but it does show all of the dependencies
+ it knows about for each Node,
+ and the order in which those dependencies are evaluated.
+ This can be useful as an alternate way to determine
+ whether or not your &SCons; configuration,
+ or the implicit dependency scan,
+ has actually identified all the correct dependencies
+ you want it to.
+
+ </para>
+
+ </section>
+
+ <!--
+
+ <section>
+
+ <title>Where Are My Build Bottlenecks? the &profile; Option</title>
+
+ <para>
+
+ XXX explain the - - profile= option
+
+ </para>
+
+ </section>
+
+ -->
+
+ <!--
+
+ <section>
+ <title>Troubleshooting Shared Caching: the &cache-debug; Option</title>
+
+ <para>
+
+ XXX describe the - - cache-debug option
+ XXX maybe point to the caching.in chapter?
+
+ </para>
+
+ </section>
+
+ -->
the tool is behaving a certain way,
and how to get it to behave the way you want.
&SCons; is no different.
+ This appendix contains a number of
+ different ways in which you can
+ get some additional insight into &SCons;' behavior.
+
+ </para>
+
+ <para>
+
+ Note that we're always interested in trying to
+ improve how you can troubleshoot configuration problems.
+ If you run into a problem that has
+ you scratching your head,
+ and which there just doesn't seem to be a good way to debug,
+ odds are pretty good that someone else will run into
+ the same problem, too.
+ If so, please let the SCons development team know
+ (preferably by filing a bug report
+ or feature request at our project pages at tigris.org)
+ so that we can use your feedback
+ to try to come up with a better way to help you,
+ and others, get the necessary insight into &SCons; behavior
+ to help identify and fix configuration issues.
</para>
<para>
- Let's take a simple example of
+ Let's look at a simple example of
a misconfigured build
that causes a target to be rebuilt
every time &SCons; is run:
<para>
- Now if we run &SCons; multiple on this example,
+ Now if we run &SCons; multiple times on this example,
we see that it re-runs the &cp;
command every time:
cc -o prog file1.o file2.o file3.o
</screen>
+ <para>
+
+ (Note that the &debug-explain; option will only tell you
+ why &SCons; decided to rebuild necessary targets.
+ It does not tell you what files it examined
+ when deciding <emphasis>not</emphasis>
+ to rebuild a target file,
+ which is often a more valuable question to answer.)
+
+ </para>
+
</section>
<section>
</para>
-
+ <programlisting>
+ env = Environment()
+ print env.Dump()
+ </programlisting>
<para>
'.spp',
'.SPP'],
'DSUFFIXES': ['.d'],
- 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c43bec>,
- 'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c43c0c>,
+ 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fdac>,
+ 'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fdcc>,
'ENV': {'PATH': '/usr/local/bin:/opt/bin:/bin:/usr/bin'},
- 'ESCAPE': <function escape at 0xb7b66c34>,
- 'File': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c43c2c>,
+ 'ESCAPE': <function escape at 0xb7ba1f0c>,
+ 'File': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fdec>,
'IDLSUFFIXES': ['.idl', '.IDL'],
- 'INSTALL': <function installFunc at 0xb7c41f0c>,
- 'INSTALLSTR': <function installStr at 0xb7c41f44>,
+ 'INSTALL': <function installFunc at 0xb7c4317c>,
+ 'INSTALLSTR': <function installStr at 0xb7c431b4>,
'LATEXSUFFIXES': ['.tex', '.ltx', '.latex'],
'LIBPREFIX': 'lib',
'LIBPREFIXES': '$LIBPREFIX',
'PLATFORM': 'posix',
'PROGPREFIX': '',
'PROGSUFFIX': '',
- 'PSPAWN': <function piped_env_spawn at 0xb7b66fb4>,
- 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c43c4c>,
+ 'PSPAWN': <function piped_env_spawn at 0xb7bb12cc>,
+ 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fe0c>,
'SCANNERS': [],
'SHELL': 'sh',
'SHLIBPREFIX': '$LIBPREFIX',
'SHLIBSUFFIX': '.so',
'SHOBJPREFIX': '$OBJPREFIX',
'SHOBJSUFFIX': '$OBJSUFFIX',
- 'SPAWN': <function spawnvpe_spawn at 0xb7b66a74>,
- 'TEMPFILE': <class SCons.Platform.TempFileMunge at 0xb7bd37ac>,
+ 'SPAWN': <function spawnvpe_spawn at 0xb7ba1d4c>,
+ 'TEMPFILE': <class SCons.Platform.TempFileMunge at 0xb7bce89c>,
'TEMPFILEPREFIX': '@',
'TOOLS': [],
'_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}',
'_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
'_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}',
'__RPATH': '$_RPATH',
- '_concat': <function _concat at 0xb7c41fb4>,
- '_defines': <function _defines at 0xb7c47064>,
- '_installStr': <function installStr at 0xb7c41f44>,
- '_stripixes': <function _stripixes at 0xb7c4702c>}
+ '_concat': <function _concat at 0xb7c43224>,
+ '_defines': <function _defines at 0xb7c432cc>,
+ '_installStr': <function installStr at 0xb7c431b4>,
+ '_stripixes': <function _stripixes at 0xb7c43294>}
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
<screen>
C:\><userinput>scons</userinput>
scons: Reading SConscript files ...
- { 'BUILDERS': {'Object': <SCons.Builder.CompositeBuilder instance at 0xb7b6024c>, 'SharedObject': <SCons.Builder.CompositeBuilder instance at 0xb7b603cc>, 'StaticObject': <SCons.Builder.CompositeBuilder instance at 0xb7b6024c>, 'PCH': <SCons.Builder.BuilderBase instance at 0xb7bd2eac>, 'RES': <SCons.Builder.BuilderBase instance at 0xb7b596ec>},
+ { 'BUILDERS': {'Object': <SCons.Builder.CompositeBuilder instance at 0xb7b6354c>, 'SharedObject': <SCons.Builder.CompositeBuilder instance at 0xb7b636cc>, 'StaticObject': <SCons.Builder.CompositeBuilder instance at 0xb7b6354c>, 'PCH': <SCons.Builder.BuilderBase instance at 0xb7bd6e8c>, 'RES': <SCons.Builder.BuilderBase instance at 0xb7b5b9ec>},
'CC': 'cl',
- 'CCCOM': <SCons.Action.FunctionAction instance at 0xb7b6086c>,
+ 'CCCOM': <SCons.Action.FunctionAction instance at 0xb7b63b6c>,
'CCCOMFLAGS': '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS',
'CCFLAGS': ['/nologo'],
'CCPCHFLAGS': ['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}'],
'CXXFILESUFFIX': '.cc',
'CXXFLAGS': ['$CCFLAGS', '$(', '/TP', '$)'],
'DSUFFIXES': ['.d'],
- 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c58bec>,
- 'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c58c0c>,
+ 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5adac>,
+ 'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5adcc>,
'ENV': { 'INCLUDE': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\include',
'LIB': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\lib',
'PATH': 'C:\\Program Files\\Microsoft Visual Studio\\Common\\tools\\WIN95;C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\bin;C:\\Program Files\\Microsoft Visual Studio\\Common\\tools;C:\\Program Files\\Microsoft Visual Studio/VC98\\bin',
'PATHEXT': '.COM;.EXE;.BAT;.CMD',
'SystemRoot': 'C:/WINDOWS'},
- 'ESCAPE': <function escape at 0xb7bc917c>,
- 'File': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c58c2c>,
+ 'ESCAPE': <function escape at 0xb7bcf454>,
+ 'File': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5adec>,
'IDLSUFFIXES': ['.idl', '.IDL'],
'INCPREFIX': '/I',
'INCSUFFIX': '',
- 'INSTALL': <function installFunc at 0xb7c56f0c>,
- 'INSTALLSTR': <function installStr at 0xb7c56f44>,
+ 'INSTALL': <function installFunc at 0xb7c5e17c>,
+ 'INSTALLSTR': <function installStr at 0xb7c5e1b4>,
'LATEXSUFFIXES': ['.tex', '.ltx', '.latex'],
'LIBPREFIX': '',
'LIBPREFIXES': ['$LIBPREFIX'],
'PLATFORM': 'win32',
'PROGPREFIX': '',
'PROGSUFFIX': '.exe',
- 'PSPAWN': <function piped_spawn at 0xb7bc90d4>,
+ 'PSPAWN': <function piped_spawn at 0xb7bcf3ac>,
'RC': 'rc',
'RCCOM': '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES',
'RCFLAGS': [],
- 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c58c4c>,
+ 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5ae0c>,
'SCANNERS': [],
'SHCC': '$CC',
- 'SHCCCOM': <SCons.Action.FunctionAction instance at 0xb7b608cc>,
+ 'SHCCCOM': <SCons.Action.FunctionAction instance at 0xb7b63bcc>,
'SHCCFLAGS': ['$CCFLAGS'],
'SHCFLAGS': ['$CFLAGS'],
'SHCXX': '$CXX',
'SHLIBSUFFIX': '.dll',
'SHOBJPREFIX': '$OBJPREFIX',
'SHOBJSUFFIX': '$OBJSUFFIX',
- 'SPAWN': <function spawn at 0xb7bc9144>,
+ 'SPAWN': <function spawn at 0xb7bcf41c>,
'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME': 1,
- 'TEMPFILE': <class SCons.Platform.TempFileMunge at 0xb7be87ac>,
+ 'TEMPFILE': <class SCons.Platform.TempFileMunge at 0xb7be989c>,
'TEMPFILEPREFIX': '@',
'TOOLS': ['msvc'],
'_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}',
'_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
'_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
'_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}',
- '_concat': <function _concat at 0xb7c56fb4>,
- '_defines': <function _defines at 0xb7c5c064>,
- '_installStr': <function installStr at 0xb7c56f44>,
- '_stripixes': <function _stripixes at 0xb7c5c02c>}
+ '_concat': <function _concat at 0xb7c5e224>,
+ '_defines': <function _defines at 0xb7c5e2cc>,
+ '_installStr': <function installStr at 0xb7c5e1b4>,
+ '_stripixes': <function _stripixes at 0xb7c5e294>}
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
</para>
-
+ <programlisting>
+ env = Environment()
+ print env.Dump('ENV')
+ </programlisting>
<para>
</screen>
</section>
+
+ <section>
+
+ <title>What Dependencies Does &SCons; Know About? the &tree; Option</title>
+
+ <para>
+
+ Sometimes the best way to try to figure out what
+ &SCons; is doing is simply to take a look at the
+ dependency graph that it constructs
+ based on your &SConscript; files.
+ The <literal>--tree</literal> option
+ will display all or part of the
+ &SCons; dependency graph in an
+ "ASCII art" graphical format
+ that shows the dependency hierarchy.
+
+ </para>
+
+ <para>
+
+ For example, given the following input &SConstruct; file:
+
+ </para>
+
+ <programlisting>
+ env = Environment(CPPPATH = ['.'])
+ env.Program('prog', ['f1.c', 'f2.c', 'f3.c'])
+ </programlisting>
+
+ <para>
+
+ Running &SCons; with the <literal>--tree=all</literal>
+ option yields:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=all</userinput>
+ cc -o f1.o -c -I. f1.c
+ cc -o f2.o -c -I. f2.c
+ cc -o f3.o -c -I. f3.c
+ cc -o prog f1.o f2.o f3.o
+ +-.
+ +--
+ +-SConstruct
+ +-f1.c
+ +-f1.o
+ | +-f1.c
+ | +-inc.h
+ +-f2.c
+ +-f2.o
+ | +-f2.c
+ | +-inc.h
+ +-f3.c
+ +-f3.o
+ | +-f3.c
+ | +-inc.h
+ +-inc.h
+ +-prog
+ +-f1.o
+ | +-f1.c
+ | +-inc.h
+ +-f2.o
+ | +-f2.c
+ | +-inc.h
+ +-f3.o
+ +-f3.c
+ +-inc.h
+ </screen>
+
+ <para>
+
+ The tree will also be printed when the
+ <literal>-n</literal> (no execute) option is used,
+ which allows you to examine the dependency graph
+ for a configuration without actually
+ rebuilding anything in the tree.
+
+ </para>
+
+ <para>
+
+ The <literal>--tree</literal> option only prints
+ the dependency graph for the specified targets
+ (or the default target(s) if none are specified on the command line).
+ So if you specify a target like <filename>f2.o</filename>
+ on the command line,
+ the <literal>--tree</literal> option will only
+ print the dependency graph for that file:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=all f2.o</userinput>
+ cc -o f2.o -c -I. f2.c
+ +-f2.o
+ +-f2.c
+ +-inc.h
+ </screen>
+
+ <para>
+
+ This is, of course, useful for
+ restricting the output from a very large
+ build configuration to just a
+ portion in which you're interested.
+ Multiple targets are fine,
+ in which case a tree will be printed
+ for each specified target:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=all f1.o f3.o</userinput>
+ cc -o f1.o -c -I. f1.c
+ +-f1.o
+ +-f1.c
+ +-inc.h
+ cc -o f3.o -c -I. f3.c
+ +-f3.o
+ +-f3.c
+ +-inc.h
+ </screen>
+
+ <para>
+
+ The <literal>status</literal> argument may be used
+ to tell &SCons; to print status information about
+ each file in the dependency graph:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=status</userinput>
+ cc -o f1.o -c -I. f1.c
+ cc -o f2.o -c -I. f2.c
+ cc -o f3.o -c -I. f3.c
+ cc -o prog f1.o f2.o f3.o
+ E = exists
+ R = exists in repository only
+ b = implicit builder
+ B = explicit builder
+ S = side effect
+ P = precious
+ A = always build
+ C = current
+ N = no clean
+ H = no cache
+
+ [E b ]+-.
+ [ ] +--
+ [E ] +-SConstruct
+ [E ] +-f1.c
+ [E B C ] +-f1.o
+ [E ] | +-f1.c
+ [E ] | +-inc.h
+ [E ] +-f2.c
+ [E B C ] +-f2.o
+ [E ] | +-f2.c
+ [E ] | +-inc.h
+ [E ] +-f3.c
+ [E B C ] +-f3.o
+ [E ] | +-f3.c
+ [E ] | +-inc.h
+ [E ] +-inc.h
+ [E B C ] +-prog
+ [E B C ] +-f1.o
+ [E ] | +-f1.c
+ [E ] | +-inc.h
+ [E B C ] +-f2.o
+ [E ] | +-f2.c
+ [E ] | +-inc.h
+ [E B C ] +-f3.o
+ [E ] +-f3.c
+ [E ] +-inc.h
+ </screen>
+
+ <para>
+
+ Note that <literal>--tree=all,status</literal> is equivalent;
+ the <literal>all</literal>
+ is assumed if only <literal>status</literal> is present.
+ As an alternative to <literal>all</literal>,
+ you can specify <literal>--tree=derived</literal>
+ to have &SCons; only print derived targets
+ in the tree output,
+ skipping source files
+ (like <filename>.c</filename> and <filename>.h</filename> files):
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=derived</userinput>
+ cc -o f1.o -c -I. f1.c
+ cc -o f2.o -c -I. f2.c
+ cc -o f3.o -c -I. f3.c
+ cc -o prog f1.o f2.o f3.o
+ +-.
+ </screen>
+
+ <para>
+
+ You can use the <literal>status</literal>
+ modifier with <literal>derived</literal> as well:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=derived,status</userinput>
+ cc -o f1.o -c -I. f1.c
+ cc -o f2.o -c -I. f2.c
+ cc -o f3.o -c -I. f3.c
+ cc -o prog f1.o f2.o f3.o
+ E = exists
+ R = exists in repository only
+ b = implicit builder
+ B = explicit builder
+ S = side effect
+ P = precious
+ A = always build
+ C = current
+ N = no clean
+ H = no cache
+
+ [E b ]+-.
+ [E B C ] +-f1.o
+ [E B C ] +-f2.o
+ [E B C ] +-f3.o
+ [E B C ] +-prog
+ [E B C ] +-f1.o
+ [E B C ] +-f2.o
+ [E B C ] +-f3.o
+ </screen>
+
+ <para>
+
+ Note that the order of the <literal>--tree=</literal>
+ arguments doesn't matter;
+ <literal>--tree=status,derived</literal> is
+ completely equivalent.
+
+ </para>
+
+ <para>
+
+ The default behavior of the <literal>--tree</literal> option
+ is to repeat all of the dependencies each time the library dependency
+ (or any other dependency file) is encountered in the tree.
+ If certain target files share other target files,
+ such as two programs that use the same library:
+
+ </para>
+
+ <programlisting>
+ env = Environment(CPPPATH = ['.'],
+ LIBS = ['foo'],
+ LIBPATH = ['.'])
+ env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
+ env.Program('prog1.c')
+ env.Program('prog2.c')
+ </programlisting>
+
+ <para>
+
+ Then there can be a <emphasis>lot</emphasis> of repetition in the
+ <literal>--tree=</literal> output:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=all</userinput>
+ cc -o f1.o -c -I. f1.c
+ cc -o f2.o -c -I. f2.c
+ cc -o f3.o -c -I. f3.c
+ ar rc libfoo.a f1.o f2.o f3.o
+ ranlib libfoo.a
+ cc -o prog1.o -c -I. prog1.c
+ cc -o prog1 prog1.o -L. -lfoo
+ cc -o prog2.o -c -I. prog2.c
+ cc -o prog2 prog2.o -L. -lfoo
+ +-.
+ +--
+ +-SConstruct
+ +-f1.c
+ +-f1.o
+ | +-f1.c
+ | +-inc.h
+ +-f2.c
+ +-f2.o
+ | +-f2.c
+ | +-inc.h
+ +-f3.c
+ +-f3.o
+ | +-f3.c
+ | +-inc.h
+ +-inc.h
+ +-libfoo.a
+ | +-f1.o
+ | | +-f1.c
+ | | +-inc.h
+ | +-f2.o
+ | | +-f2.c
+ | | +-inc.h
+ | +-f3.o
+ | +-f3.c
+ | +-inc.h
+ +-prog1
+ | +-prog1.o
+ | | +-prog1.c
+ | | +-inc.h
+ | +-libfoo.a
+ | +-f1.o
+ | | +-f1.c
+ | | +-inc.h
+ | +-f2.o
+ | | +-f2.c
+ | | +-inc.h
+ | +-f3.o
+ | +-f3.c
+ | +-inc.h
+ +-prog1.c
+ +-prog1.o
+ | +-prog1.c
+ | +-inc.h
+ +-prog2
+ | +-prog2.o
+ | | +-prog2.c
+ | | +-inc.h
+ | +-libfoo.a
+ | +-f1.o
+ | | +-f1.c
+ | | +-inc.h
+ | +-f2.o
+ | | +-f2.c
+ | | +-inc.h
+ | +-f3.o
+ | +-f3.c
+ | +-inc.h
+ +-prog2.c
+ +-prog2.o
+ +-prog2.c
+ +-inc.h
+ </screen>
+
+ <para>
+
+ In a large configuration with many internal libraries
+ and include files,
+ this can very quickly lead to huge output trees.
+ To help make this more manageable,
+ a <literal>prune</literal> modifier may
+ be added to the option list,
+ in which case &SCons;
+ will print the name of a target that has
+ already been visited during the tree-printing
+ in <literal>[square brackets]</literal>
+ as an indication that the dependencies
+ of the target file may be found
+ by looking farther up the tree:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --tree=prune</userinput>
+ cc -o f1.o -c -I. f1.c
+ cc -o f2.o -c -I. f2.c
+ cc -o f3.o -c -I. f3.c
+ ar rc libfoo.a f1.o f2.o f3.o
+ ranlib libfoo.a
+ cc -o prog1.o -c -I. prog1.c
+ cc -o prog1 prog1.o -L. -lfoo
+ cc -o prog2.o -c -I. prog2.c
+ cc -o prog2 prog2.o -L. -lfoo
+ +-.
+ +--
+ +-SConstruct
+ +-f1.c
+ +-f1.o
+ | +-[f1.c]
+ | +-inc.h
+ +-f2.c
+ +-f2.o
+ | +-[f2.c]
+ | +-[inc.h]
+ +-f3.c
+ +-f3.o
+ | +-[f3.c]
+ | +-[inc.h]
+ +-[inc.h]
+ +-libfoo.a
+ | +-[f1.o]
+ | +-[f2.o]
+ | +-[f3.o]
+ +-prog1
+ | +-prog1.o
+ | | +-prog1.c
+ | | +-[inc.h]
+ | +-[libfoo.a]
+ +-[prog1.c]
+ +-[prog1.o]
+ +-prog2
+ | +-prog2.o
+ | | +-prog2.c
+ | | +-[inc.h]
+ | +-[libfoo.a]
+ +-[prog2.c]
+ +-[prog2.o]
+ </screen>
+
+ <para>
+
+ Like the <literal>status</literal> keyword,
+ the <literal>prune</literal> argument by itself
+ is equivalent to <literal>--tree=all,prune</literal>.
+
+ </para>
+
+ </section>
+
+ <section>
+
+ <title>How is &SCons; Constructing the Command Lines It Executes? the &debug-presub; Option</title>
+
+ <para>
+
+ Sometimes it's useful to look at the
+ pre-substitution string
+ that &SCons; uses to generate
+ the command lines it executes.
+ This can be done with the &debug-presub; option:
+
+ </para>
+
+
+
+ <!--
+
+ Have to capture output here, otherwise the - -debug=presub output
+ shows the Python functions from the sconsdoc.py execution wrapper
+ used to generate this manual, not the underlying command-line strings.
+
+ <scons_output example="presub">
+ <scons_output_command>scons -Q - -debug=presub</scons_output_command>
+ </scons_output>
+
+ -->
+
+ <screen>
+ % <userinput>scons -Q --debug=presub</userinput>
+ Building prog.o with action:
+ $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCOMCOM $SOURCES
+ cc -o prog.o -c -I. prog.c
+ Building prog with action:
+ $SMART_LINKCOM
+ cc -o prog prog.o
+ </screen>
+
+ </section>
+
+ <section>
+
+ <title>Where is &SCons; Searching for Libraries? the &debug-findlibs; Option</title>
+
+ <para>
+
+ To get some insight into what library names
+ &SCons; is searching for,
+ and in which directories it is searching,
+ Use the <literal>--debug=findlibs</literal> option.
+ Given the following input &SConstruct; file:
+
+ </para>
+
+ <programlisting>
+ env = Environment(LIBPATH = ['libs1', 'libs2'])
+ env.Program('prog.c', LIBS=['foo', 'bar'])
+ </programlisting>
+
+ <para>
+
+ And the libraries <filename>libfoo.a</filename>
+ and <filename>libbar.a</filename>
+ in <filename>libs1</filename> and <filename>libs2</filename>,
+ respectively,
+ use of the <literal>--debug=findlibs</literal> option yields:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --debug=findlibs</userinput>
+ findlibs: looking for 'libfoo.a' in 'libs1' ...
+ findlibs: ... FOUND 'libfoo.a' in 'libs1'
+ findlibs: looking for 'libfoo.so' in 'libs1' ...
+ findlibs: looking for 'libfoo.so' in 'libs2' ...
+ findlibs: looking for 'libbar.a' in 'libs1' ...
+ findlibs: looking for 'libbar.a' in 'libs2' ...
+ findlibs: ... FOUND 'libbar.a' in 'libs2'
+ findlibs: looking for 'libbar.so' in 'libs1' ...
+ findlibs: looking for 'libbar.so' in 'libs2' ...
+ cc -o prog.o -c prog.c
+ cc -o prog prog.o -Llibs1 -Llibs2 -lfoo -lbar
+ </screen>
+
+ </section>
+
+ <!--
+
+ <section>
+
+ <title>What Implicit Dependencies Did the &SCons; Scanner find? the &debug-includes; Option</title>
+
+ <para>
+
+ XXX explain the - - debug=includes option
+
+ </para>
+
+ <scons_example name="includes">
+ <file name="SConstruct" printme="1">
+ env = Environment(CPPPATH = ['inc1', 'inc2'])
+ env.Program('prog.c')
+ </file>
+ <file name="prog.c">
+ #include "file1.h"
+ #include "file2.h"
+ prog.c
+ </file>
+ <file name="inc1/file1.h">
+ inc1/file1.h
+ </file>
+ <file name="inc2/file2.h">
+ inc2/file2.h
+ </file>
+ </scons_example>
+
+ <scons_output example="includes">
+ <scons_output_command>scons -Q - - debug=includes prog</scons_output_command>
+ </scons_output>
+
+ </section>
+
+ -->
+
+ <section>
+
+ <title>Where is &SCons; Blowing Up? the &debug-stacktrace; Option</title>
+
+ <para>
+
+ In general, &SCons; tries to keep its error
+ messages short and informative.
+ That means we usually try to avoid showing
+ the stack traces that are familiar
+ to experienced Python programmers,
+ since they usually contain much more
+ information than is useful to most people.
+
+ </para>
+
+ <para>
+
+ For example, the following &SConstruct; file:
+
+ </para>
+
+ <programlisting>
+ Program('prog.c')
+ </programlisting>
+
+ <para>
+
+ Generates the following error if the
+ <filename>prog.c</filename> file
+ does not exist:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ scons: *** Source `prog.c' not found, needed by target `prog.o'. Stop.
+ </screen>
+
+ <para>
+
+ In this case,
+ the error is pretty obvious.
+ But if it weren't,
+ and you wanted to try to get more information
+ about the error,
+ the &debug-stacktrace; option
+ would show you exactly where in the &SCons; source code
+ the problem occurs:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q --debug=stacktrace</userinput>
+ scons: *** Source `prog.c' not found, needed by target `prog.o'. Stop.
+ scons: internal stack trace:
+ File "/home/knight/SCons/scons.0.96.C763/bootstrap/src/engine/SCons/Job.py", line 111, in start
+ task.prepare()
+ File "/home/knight/SCons/scons.0.96.C763/bootstrap/src/engine/SCons/Taskmaster.py", line 166, in prepare
+ t.prepare()
+ File "/home/knight/SCons/scons.0.96.C763/bootstrap/src/engine/SCons/Node/FS.py", line 2137, in prepare
+ SCons.Node.Node.prepare(self)
+ File "/home/knight/SCons/scons.0.96.C763/bootstrap/src/engine/SCons/Node/__init__.py", line 806, in prepare
+ raise SCons.Errors.StopError, desc
+ </screen>
+
+ <para>
+
+ Of course, if you do need to dive into the &SCons; source code,
+ we'd like to know if, or how,
+ the error messages or troubleshooting options
+ could have been improved to avoid that.
+ Not everyone has the necessary time or
+ Python skill to dive into the source code,
+ and we'd like to improve &SCons;
+ for those people as well...
+
+ </para>
+
+ </section>
+
+ <section>
+
+ <title>How is &SCons; Making Its Decisions? the &taskmastertrace; Option</title>
+
+ <para>
+
+ The internal &SCons; subsystem that handles walking
+ the dependency graph
+ and controls the decision-making about what to rebuild
+ is the <literal>Taskmaster</literal>.
+ &SCons; supports a <literal>--taskmastertrace</literal>
+ option that tells the Taskmaster to print
+ information about the children (dependencies)
+ of the various Nodes on its walk down the graph,
+ which specific dependent Nodes are being evaluated,
+ and in what order.
+
+ </para>
+
+ <para>
+
+ The <literal>--taskmastertrace</literal> option
+ takes as an argument the name of a file in
+ which to put the trace output,
+ with <filename>-</filename> (a single hyphen)
+ indicating that the trace messages
+ should be printed to the standard output:
+
+ </para>
+
+ <programlisting>
+ env = Environment(CPPPATH = ['.'])
+ env.Program('prog.c')
+ </programlisting>
+
+ <screen>
+ % <userinput>scons -Q --taskmastertrace=- prog</userinput>
+ Taskmaster: 'prog': children:
+ ['prog.o']
+ waiting on unstarted children:
+ ['prog.o']
+ Taskmaster: 'prog.o': children:
+ ['inc.h', 'prog.c']
+ evaluating prog.o
+ cc -o prog.o -c -I. prog.c
+ Taskmaster: 'prog': children:
+ ['prog.o']
+ evaluating prog
+ cc -o prog prog.o
+ Taskmaster: 'prog': already handled (executed)
+ </screen>
+
+ <para>
+
+ The <literal>--taskmastertrace</literal> option
+ doesn't provide information about the actual
+ calculations involved in deciding if a file is up-to-date,
+ but it does show all of the dependencies
+ it knows about for each Node,
+ and the order in which those dependencies are evaluated.
+ This can be useful as an alternate way to determine
+ whether or not your &SCons; configuration,
+ or the implicit dependency scan,
+ has actually identified all the correct dependencies
+ you want it to.
+
+ </para>
+
+ </section>
+
+ <!--
+
+ <section>
+
+ <title>Where Are My Build Bottlenecks? the &profile; Option</title>
+
+ <para>
+
+ XXX explain the - - profile= option
+
+ </para>
+
+ </section>
+
+ -->
+
+ <!--
+
+ <section>
+ <title>Troubleshooting Shared Caching: the &cache-debug; Option</title>
+
+ <para>
+
+ XXX describe the - - cache-debug option
+ XXX maybe point to the caching.in chapter?
+
+ </para>
+
+ </section>
+
+ -->
%define name scons
-%define version 0.96.94
+%define version 0.96.96
%define release 1
Summary: an Open Source software construction tool
qmtest = q
else:
sys.stderr.write('Warning: %s not found on $PATH, assuming --noqmtest option.\n' % q)
+ sys.stderr.flush()
aegis = whereis('aegis')
-RELEASE 0.97 - XXX
+RELEASE 0.96.96 - Thu, 12 Apr 2007 12:36:25 -0500
+
+ NOTE: This is (Yet) a(nother) pre-release of 0.97 for testing purposes.
+
+ From Joe Bloggs:
+
+ - Man page fix: remove cut-and-paste sentence in NoCache() description.
+
+ From Dmitry Grigorenko and Gary Oberbrunner:
+
+ - Use the Intel C++ compiler, not $CC, to link C++ source.
+
+ From Helmut Grohne:
+
+ - Fix the man page example of propagating a user's external environment.
+
+ From Steven Knight:
+
+ - Back out (most of) the Windows registry installer patch, which
+ seems to not work on some versions of Windows.
+
+ - Don't treat Java ".class" attributes as defining an inner class.
+
+ - Fix detecting an erroneous Java anonymous class when the first
+ non-skipped token after a "new" keyword is a closing brace.
+
+ - Fix a regression when a CPPDEFINES list contains a tuple, the second
+ item of which (the option value) is a construction variable expansion
+ (e.g. $VALUE) and the value of the variable isn't a string.
+
+ - Improve the error message if an IOError (like trying to read a
+ directory as a file) occurs while deciding if a node is up-to-date.
+
+ - Fix "maximum recursion" / "unhashable type" errors in $CPPPATH
+ PathList expansion if a subsidiary expansion yields a stringable,
+ non-Node object.
+
+ - Generate API documentation from the docstrings (using epydoc).
+
+ - Fix use of --debug=presub with Actions for out-of-the-box Builders.
+
+ - Fix handling nested lists within $CPPPATH, $LIBPATH, etc.
+
+ - Fix a "builders_used" AttributeError that real-world Qt initialization
+ triggered in the refactored suffix handling for Builders.
+
+ - Make the reported --debug=time timings meaningful when used with -j.
+ Better documentation of what the times mean.
+
+ - User Guide updates: --random, AlwaysBuild(), --tree=,
+ --debug=findlibs, --debug=presub, --debug=stacktrace,
+ --taskmastertrace.
+
+ - Document (in both man page and User's Guide) that --implicit-cache
+ ignores changes in $CPPPATH, $LIBPATH, etc.
+
+ From Jean-Baptiste Lab:
+
+ - Remove hard-coded dependency on Python 2.2 from Debian packaging files.
+
+ From Jeff Mahovsky:
+
+ - Handle spaces in the build target name in Visual Studio project files.
+
+ From Rob Managan:
+
+ - Re-run LaTeX after BibTeX has been re-run in response to a changed
+ .bib file.
+
+ From Joel B. Mohler:
+
+ - Make additional TeX auxiliary files (.toc, .idx and .bbl files)
+ Precious so their removal doesn't affect whether the necessary
+ sections are included in output PDF or PostScript files.
+
+ From Gary Oberbrunner:
+
+ - Fix the ability to import modules in the site_scons directory from
+ a subdirectory.
+
+ From Adam Simpkins:
+
+ - Make sure parallel (-j) builds all targets even if they show up
+ multiple times in the child list (as a source and a dependency).
+
+ From Matthias Troffaes:
+
+ - Don't re-run TeX if the triggering strings (\makeindex, \bibliography
+ \tableofcontents) are commented out.
+
+ From Richard Viney:
+
+ - Fix use of custom include and lib paths with Visual Studio 8.
+
+ - Select the default .NET Framework SDK Dir based on the version of
+ Visual Studio being used.
+
+
+
+RELEASE 0.96.95 - Mon, 12 Feb 2007 20:25:16 -0600
From Anatoly:
-RELEASE 0.96.93 - Mon, 06 Nov 2006 00:44:11 -0600
-
- NOTE: This is a pre-release of 0.97 for testing purposes.
-
- From Anonymous:
-
- - Allow arbitrary white space after a SWIG %module declaration.
-
- From Paul:
-
- - When compiling resources under MinGW, make sure there's a space
- between the --include-dir option and its argument.
-
- From Jay Kint:
-
- - Alleviate long command line issues on Windows by executing command
- lines directly via os.spawnv() if the command line doesn't need
- shell interpretation (has no pipes, redirection, etc.).
-
- From Walter Franzini:
-
- - Exclude additional Debian packaging files from the copyright check.
-
- From Fawad Halim:
-
- - Handle the conflict between the impending Python 2.6 'as' keyword
- and our Tool/as.py module name.
-
- From Steven Knight:
-
- - Speed up the Node.FS.Dir.rel_path() method used to generate path names
- that get put into the .sconsign* file(s).
-
- - Optimize Node.FS.Base.get_suffix() by computing the suffix once, up
- front, when we set the Node's name. (Duh...)
-
- - Reduce the Memoizer's responsibilities to simply counting hits and
- misses when the --debug=memoizer option is used, not to actually
- handling the key calculation and memoization itself. This speeds
- up some configurations significantly, and should cause no functional
- differences.
-
- - Add a new scons-time script with subcommands for generating
- consistent timing output from SCons configurations, extracting
- various information from those timings, and displaying them in
- different formats.
-
- - Reduce some unnecessary stat() calls from on-disk entry type checks.
-
- - Fix SideEffect() when used with -j, which was badly broken in 0.96.93.
-
- - Propagate TypeError exceptions when evaluating construction variable
- expansions up the stack, so users can see what's going on.
-
- - When disambiguating a Node.FS.Entry into a Dir or File, don't look
- in the on-disk source directory until we've confirmed there's no
- on-disk entry locally and there *is* one in the srcdir. This avoids
- creating a phantom Node that can interfere with dependencies on
- directory contents.
-
- - Add an AllowSubstExceptions() function that gives the SConscript
- files control over what exceptions cause a string to expand to ''
- vs. terminating processing with an error.
-
- - Allow the f90.py and f95.py Tool modules to compile earlier source
- source files of earlier Fortran version.
-
- - Fix storing signatures of files retrieved from CacheDir() so they're
- correctly identified as up-to-date next invocation.
-
- - Make sure lists of computed source suffixes cached by Builder objects
- don't persist across changes to the list of source Builders (so the
- addition of suffixes like .ui by the qt.py Tool module take effect).
-
- - Enhance the bootstrap.py script to allow it to be used to execute
- SCons more easily from a checked-out source tree.
-
- From Ben Leslie:
-
- - Fix post-Memoizer value caching misspellings in Node.FS._doLookup().
-
- From Rob Managan, Dmitry Mikhin and Joel B. Mohler:
-
- - Handle TeX/LaTeX files in subdirectories by changing directory
- before invoking TeX/LaTeX.
-
- - Scan LaTeX files for \bibliography lines.
-
- - Support multiple file names in a "\bibliography{file1,file2}" string.
-
- - Handle TeX warnings about undefined citations.
-
- - Support re-running LaTeX if necessary due to a Table of Contents.
-
- From Dmitry Mikhin:
-
- - Return LaTeX if "Rerun to get citations correct" shows up on the next
- line after the "Warning:" string.
-
- From Gary Oberbrunner:
-
- - Add #include lines to fix portability issues in two tests.
-
- - Eliminate some unnecessary os.path.normpath() calls.
-
- - Add a $CFLAGS variable for C-specific options, leaving $CCFLAGS
- for options common to C and C++.
-
- From Tom Parker:
-
- - Have the error message print the missing file that Qt can't find.
-
- From John Pye:
-
- - Fix env.MergeFlags() appending to construction variable value of None.
-
- From Steve Robbins:
-
- - Fix the "sconsign" script when the .sconsign.dblite file is explicitly
- specified on the command line (and not intuited from the old way of
- calling it with just ".sconsign").
-
- From Jose Pablo Ezequiel "Pupeno" Fernandez Silva:
-
- - Give the 'lex' tool knowledge of the additional target files produced
- by the flex "--header-file=" and "--tables-file=" options.
-
- - Give the 'yacc' tool knowledge of the additional target files produced
- by the bison "-g", "--defines=" and "--graph=" options.
-
- - Generate intermediate files with Objective C file suffixes (.m) when
- the lex and yacc source files have appropriate suffixes (.lm and .ym).
-
- From Sohail Somain:
-
- - Have the mslink.py Tool only look for a 'link' executable on Windows
- systems.
-
- From Vaclav Smilauer:
-
- - Add support for a "srcdir" keyword argument when calling a Builder,
- which will add a srcdir prefix to all non-relative string sources.
-
- From Jonathan Ultis:
-
- - Allow Options converters to take the construction environment as
- an optional argument.
-
-
-
RELEASE 0.96.93 - Mon, 06 Nov 2006 00:44:11 -0600
NOTE: This is a pre-release of 0.97 for testing purposes.
-RELEASE 0.97 - XXX
+RELEASE 0.96.96 - Thu, 12 Apr 2007 12:36:25 -0500
This is a pre-release for testing the eighth beta release of SCons.
Please consult the CHANGES.txt file for a list of specific changes
SCons/Action.py
SCons/Builder.py
SCons/compat/__init__.py
-SCons/compat/_sets.py
-SCons/compat/_sets15.py
-SCons/compat/_subprocess.py
-SCons/compat/_UserString.py
+SCons/compat/_scons_sets.py
+SCons/compat/_scons_sets15.py
+SCons/compat/_scons_subprocess.py
+SCons/compat/_scons_UserString.py
SCons/compat/builtins.py
SCons/Conftest.py
SCons/cpp.py
def __init__(self, strfunction=_null, presub=_null, chdir=None, exitstatfunc=None, **kw):
if not strfunction is _null:
self.strfunction = strfunction
- if presub is _null:
- presub = print_actions_presub
self.presub = presub
self.chdir = chdir
if not exitstatfunc:
if not SCons.Util.is_List(source):
source = [source]
if exitstatfunc is _null: exitstatfunc = self.exitstatfunc
- if presub is _null: presub = self.presub
+ if presub is _null:
+ presub = self.presub
+ if presub is _null:
+ presub = print_actions_presub
if show is _null: show = print_actions
if execute is _null: execute = execute_actions
if chdir is _null: chdir = self.chdir
result = a("out", "in", env)
assert result == 7, result
s = sio.getvalue()
+ assert s == 'Building out with action:\n execfunc(target, source, env)\nexecfunc(["out"], ["in"])\n', s
+
+ sio = StringIO.StringIO()
+ sys.stdout = sio
+ result = a("out", "in", env, presub=0)
+ assert result == 7, result
+ s = sio.getvalue()
assert s == 'execfunc(["out"], ["in"])\n', s
sio = StringIO.StringIO()
(This value isn't cached because there may be changes in a
src_builder many levels deep that we can't see.)
"""
+ sdict = {}
suffixes = self.subst_src_suffixes(env)
+ for s in suffixes:
+ sdict[s] = 1
for builder in self.get_src_builders(env):
- suffixes.extend(builder.src_suffixes(env))
+ for s in builder.src_suffixes(env):
+ if not sdict.has_key(s):
+ sdict[s] = 1
+ suffixes.append(s)
return suffixes
class CompositeBuilder(SCons.Util.Proxy):
"Unexpected tgt.sources[0] name: %s" % tgt.sources[0].path
b2 = SCons.Builder.Builder(src_suffix = '.2', src_builder = b1)
- assert b2.src_suffixes(env) == ['.2', '.c'], b2.src_suffixes(env)
+ r = b2.src_suffixes(env)
+ r.sort()
+ assert r == ['.2', '.c'], r
b3 = SCons.Builder.Builder(action = {'.3a' : '', '.3b' : ''})
s = b3.src_suffixes(env)
s = map(str, tgt.sources[0].sources)
assert s == ['aaa.bar'], s
- builder3 = SCons.Builder.Builder(action = 'foo',
- src_builder = 'xyzzy',
- src_suffix = '.xyzzy')
- assert builder3.get_src_builders(Environment()) == []
-
builder4 = SCons.Builder.Builder(action='bld4',
src_suffix='.i',
suffix='_wrap.c')
assert r == '', r
r = builder.src_suffixes(env)
assert r == [], r
- r = builder.targets('foo')
- assert r == ['foo'], r
# src_suffix can be a single string or a list of strings
# src_suffixes() caches its return value, so we use a new
r = bld.get_src_suffix(env)
assert r == '.bar', r
r = bld.src_suffixes(env)
+ r.sort()
assert r == ['.bar', '.foo'], r
# adjust_suffix normalizes the suffix, adding a `.' if needed
r = builder.get_src_suffix(env)
assert r == '.src_sfx1', r
r = builder.src_suffixes(env)
+ r.sort()
assert r == ['.src_sfx1', '.src_sfx2'], r
assert b5.get_name(None) == 'builder5', b5.get_name(None)
assert b6.get_name(None) in b6_names, b6.get_name(None)
- for B in b3.get_src_builders(env):
- assert B.get_name(env) == 'bldr1'
- for B in b3.get_src_builders(env2):
- assert B.get_name(env2) == 'B1'
-
tgt = b4(env, target = 'moo', source='cow')
assert tgt[0].builder.get_name(env) == 'bldr4'
return 'Install %s: "%s" as "%s"' % (type, source, dest)
def _concat(prefix, list, suffix, env, f=lambda x: x, target=None, source=None):
- """Creates a new list from 'list' by first interpolating each
- element in the list using the 'env' dictionary and then calling f
- on the list, and finally concatenating 'prefix' and 'suffix' onto
- each element of the list. A trailing space on 'prefix' or leading
- space on 'suffix' will cause them to be put into separate list
- elements rather than being concatenated."""
-
+ """
+ Creates a new list from 'list' by first interpolating each element
+ in the list using the 'env' dictionary and then calling f on the
+ list, and finally calling _concat_ixes to concatenate 'prefix' and
+ 'suffix' onto each element of the list.
+ """
if not list:
return list
if not l is None:
list = l
+ return _concat_ixes(prefix, list, suffix, env)
+
+def _concat_ixes(prefix, list, suffix, env):
+ """
+ Creates a new list from 'list' by concatenating the 'prefix' and
+ 'suffix' arguments onto each element of the list. A trailing space
+ on 'prefix' or leading space on 'suffix' will cause them to be put
+ into separate list elements rather than being concatenated.
+ """
+
result = []
# ensure that prefix and suffix are strings
return result
return c(prefix, list, suffix, env, f)
-def _defines(prefix, defs, suffix, env, c=_concat):
- """A wrapper around _concat that turns a list or string
+# This is an alternate _stripixes() function that passes all of our tests
+# (as of 21 February 2007), like the current version above. It's more
+# straightforward because it does its manipulation directly, not using
+# the funky f call-back function to _concat(). (In this respect it's
+# like the updated _defines() function below.)
+#
+# The most convoluted thing is that it still uses a custom _concat()
+# function if one was placed in the construction environment; there's
+# a specific test for that functionality, but it might be worth getting
+# rid of.
+#
+# Since this work was done while trying to get 0.97 out the door
+# (just prior to 0.96.96), I decided to be cautious and leave the old
+# function as is, to minimize the chance of other corner-case regressions.
+# The updated version is captured here so we can uncomment it and start
+# using it at a less sensitive time in the development cycle (or when
+# it's clearly required to fix something).
+#
+#def _stripixes(prefix, list, suffix, stripprefix, stripsuffix, env, c=None):
+# """
+# This is a wrapper around _concat()/_concat_ixes() that checks for the
+# existence of prefixes or suffixes on list elements and strips them
+# where it finds them. This is used by tools (like the GNU linker)
+# that need to turn something like 'libfoo.a' into '-lfoo'.
+# """
+#
+# if not list:
+# return list
+#
+# if not callable(c):
+# env_c = env['_concat']
+# if env_c != _concat and callable(env_c):
+# # There's a custom _concat() method in the construction
+# # environment, and we've allowed people to set that in
+# # the past (see test/custom-concat.py), so preserve the
+# # backwards compatibility.
+# c = env_c
+# else:
+# c = _concat_ixes
+#
+# if SCons.Util.is_List(list):
+# list = SCons.Util.flatten(list)
+#
+# lsp = len(stripprefix)
+# lss = len(stripsuffix)
+# stripped = []
+# for l in SCons.PathList.PathList(list).subst_path(env, None, None):
+# if isinstance(l, SCons.Node.FS.File):
+# stripped.append(l)
+# continue
+# if not SCons.Util.is_String(l):
+# l = str(l)
+# if l[:lsp] == stripprefix:
+# l = l[lsp:]
+# if l[-lss:] == stripsuffix:
+# l = l[:-lss]
+# stripped.append(l)
+#
+# return c(prefix, stripped, suffix, env)
+
+def _defines(prefix, defs, suffix, env, c=_concat_ixes):
+ """A wrapper around _concat_ixes that turns a list or string
into a list of C preprocessor command-line definitions.
"""
if SCons.Util.is_List(defs):
l.append(str(k) + '=' + str(v))
else:
l = [str(defs)]
- return c(prefix, l, suffix, env)
+ return c(prefix, env.subst_path(l), suffix, env)
class NullCmdGenerator:
"""This is a callable class that can be used in place of other
fmt = " %7d hits %7d misses %s()"
print fmt % (self.hit, self.miss, self.name)
def __cmp__(self, other):
- return cmp(self.name, other.name)
+ try:
+ return cmp(self.name, other.name)
+ except AttributeError:
+ return 0
class CountValue(Counter):
"""
def get_contents(self):
if not self.rexists():
return ''
- return open(self.rfile().abspath, "rb").read()
+ fname = self.rfile().abspath
+ try:
+ r = open(fname, "rb").read()
+ except EnvironmentError, e:
+ if not e.filename:
+ e.filename = fname
+ raise
+ return r
def get_timestamp(self):
if self.rexists():
import string
import SCons.Memoize
+import SCons.Node
import SCons.Util
#
try:
get = obj.get
except AttributeError:
- pass
+ if isinstance(obj, SCons.Node.Node):
+ result = obj
+ else:
+ result = str(obj)
else:
- obj = get()
- return obj
+ result = get()
+ return result
class _PathList:
"""
"""
if SCons.Util.is_String(pathlist):
pathlist = string.split(pathlist, os.pathsep)
- elif SCons.Util.is_List(pathlist) or SCons.Util.is_Tuple(pathlist):
- pathlist = SCons.Util.flatten(pathlist)
- else:
+ elif not SCons.Util.is_Sequence(pathlist):
pathlist = [pathlist]
pl = []
if type == TYPE_STRING_SUBST:
value = env.subst(value, target=target, source=source,
conv=node_conv)
+ if SCons.Util.is_Sequence(value):
+ # It came back as a string or tuple, which in this
+ # case usually means some variable expanded to an
+ # actually Dir node. Concatenate the values.
+ value = string.join(map(str, value), '')
elif type == TYPE_OBJECT:
value = node_conv(value)
result.append(value)
"""
Returns the key for memoization of PathLists.
- Note that we want this to be quick, so we don't canonicalize
- all forms of the same list. For example, 'x:y' and ['x', 'y']
- logically represent the same list, but we're not going to bother
- massaging strings into canonical lists here.
-
- The reason
-
+ Note that we want this to be pretty quick, so we don't completely
+ canonicalize all forms of the same list. For example,
+ 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically
+ represent the same list if you're executing from $ROOT, but
+ we're not going to bother splitting strings into path elements,
+ or massaging strings into Nodes, to identify that equivalence.
+ We just want to eliminate obvious redundancy from the normal
+ case of re-using exactly the same cloned value for a path.
"""
- if SCons.Util.is_List(pathlist):
- pathlist = tuple(pathlist)
+ if SCons.Util.is_Sequence(pathlist):
+ pathlist = tuple(SCons.Util.flatten(pathlist))
return pathlist
-
+
memoizer_counters.append(SCons.Memoize.CountDict('PathList', _PathList_key))
def PathList(self, pathlist):
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import unittest
import SCons.PathList
self.env = FakeEnvironment(AAA = 'aaa')
- def test_object(self):
- """Test the subst_path() method on an object
+ def test_node(self):
+ """Test the subst_path() method on a Node
"""
+ import SCons.Node
+
class A:
pass
+ n = SCons.Node.Node()
+
+ pl = SCons.PathList.PathList((n,))
+
+ result = pl.subst_path(self.env, 'y', 'z')
+
+ assert result == (n,), result
+
+ def test_object(self):
+ """Test the subst_path() method on a non-Node object
+ """
+
+ class A:
+ def __str__(self):
+ return '<object A>'
+
a = A()
pl = SCons.PathList.PathList((a,))
result = pl.subst_path(self.env, 'y', 'z')
- assert result == (a,), result
+ assert result == ('<object A>',), result
def test_object_get(self):
"""Test the subst_path() method on an object with a get() method
display = SCons.Util.display
progress_display = SCons.Util.DisplayEngine()
+first_command_start = None
+last_command_end = None
+
# Task control.
#
class BuildTask(SCons.Taskmaster.Task):
if target.has_builder() and not hasattr(target.builder, 'status'):
if print_time:
start_time = time.time()
+ global first_command_start
+ if first_command_start is None:
+ first_command_start = start_time
SCons.Taskmaster.Task.execute(self)
if print_time:
+ global cumulative_command_time
+ global last_command_end
finish_time = time.time()
- global command_time
- command_time = command_time+finish_time-start_time
- print "Command execution time: %f seconds"%(finish_time-start_time)
+ last_command_end = finish_time
+ cumulative_command_time = cumulative_command_time+finish_time-start_time
+ sys.stdout.write("Command execution time: %f seconds\n"%(finish_time-start_time))
break
else:
if self.top and target.has_builder():
print_time = 0
ignore_errors = 0
sconscript_time = 0
-command_time = 0
+cumulative_command_time = 0
exit_status = 0 # exit status, assume success by default
repositories = []
-num_jobs = 1 # this is modifed by SConscript.SetJobs()
+num_jobs = None
delayed_warnings = []
diskcheck_all = SCons.Node.FS.diskcheck_types()
site_init_filename = "site_init.py"
site_init_modname = "site_init"
site_tools_dirname = "site_tools"
- sys.path = [site_dir] + sys.path
+ sys.path = [os.path.abspath(site_dir)] + sys.path
site_init_file = os.path.join(site_dir, site_init_filename)
site_tools_dir = os.path.join(site_dir, site_tools_dirname)
if os.path.exists(site_init_file):
tmtrace = None
taskmaster = SCons.Taskmaster.Taskmaster(nodes, task_class, order, tmtrace)
- nj = ssoptions.get('num_jobs')
- jobs = SCons.Job.Jobs(nj, taskmaster)
- if nj > 1 and jobs.num_jobs == 1:
+ global num_jobs
+ num_jobs = ssoptions.get('num_jobs')
+ jobs = SCons.Job.Jobs(num_jobs, taskmaster)
+ if num_jobs > 1 and jobs.num_jobs == 1:
msg = "parallel builds are unsupported by this version of Python;\n" + \
"\tignoring -j or num_jobs option.\n"
SCons.Warnings.warn(SCons.Warnings.NoParallelSupportWarning, msg)
def main():
global exit_status
+ global first_command_start
try:
_exec_main()
SCons.Taskmaster.dump_stats()
if print_time:
- total_time = time.time()-SCons.Script.start_time
- scons_time = total_time-sconscript_time-command_time
+ total_time = time.time() - SCons.Script.start_time
+ if num_jobs == 1:
+ ct = cumulative_command_time
+ else:
+ ct = last_command_end - first_command_start
+ scons_time = total_time - sconscript_time - ct
print "Total build time: %f seconds"%total_time
print "Total SConscript file execution time: %f seconds"%sconscript_time
print "Total SCons execution time: %f seconds"%scons_time
- print "Total command execution time: %f seconds"%command_time
+ print "Total command execution time: %f seconds"%ct
sys.exit(exit_status)
#exit_status = Main.exit_status
#profiling = Main.profiling
repositories = Main.repositories
-#num_jobs = Main.num_jobs # settable by SConscript.SetJobs()
#
import SConscript
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import string
import sys
import traceback
"""
self.out_of_date = []
for t in self.targets:
- if t.disambiguate().current():
+ try:
+ is_up_to_date = t.disambiguate().current()
+ except EnvironmentError, e:
+ raise SCons.Errors.BuildError(node=t, errstr=e.strerror, filename=e.filename)
+ if is_up_to_date:
t.set_state(SCons.Node.up_to_date)
else:
self.out_of_date.append(t)
# list will get cleared and we'll re-scan the newly-built
# file(s) for updated implicit dependencies.
map(lambda n, P=node: n.add_to_waiting_parents(P), not_started)
- node.ref_count = len(not_started)
+ node.ref_count = len(set(not_started))
# Now we add these derived targets to the candidates
# list so they can be examined and built. We have to
# dependency list will get cleared and we'll re-scan the
# newly-built file(s) for updated implicit dependencies.
map(lambda n, P=node: n.add_to_waiting_parents(P), not_built)
- node.ref_count = len(not_built)
+ node.ref_count = len(set(not_built))
if S: S.not_built = S.not_built + 1
if T:
<summary>
The string displayed when fetching
a source file using BitKeeper.
-If this is not set, then &cv-BITKEEPERCOM;
+If this is not set, then &cv-link-BITKEEPERCOM;
(the command line) is displayed.
</summary>
</cvar>
<cvar name="BITKEEPERGET">
<summary>
-The command (&cv-BITKEEPER;) and subcommand
+The command (&cv-link-BITKEEPER;) and subcommand
for fetching source files using BitKeeper.
</summary>
</cvar>
<summary>
The string displayed when fetching
a source file from a CVS repository.
-If this is not set, then &cv-CVSCOM;
+If this is not set, then &cv-link-CVSCOM;
(the command line) is displayed.
</summary>
</cvar>
<summary>
The path to the CVS repository.
This is referenced in the default
-&cv-CVSFLAGS; value.
+&cv-link-CVSFLAGS; value.
</summary>
</cvar>
# any alphanumeric token (keyword, class name, specifier);
# the multi-line comment begin and end tokens /* and */;
# array declarations "[]";
- # semi-colons.
- _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;]|' +
+ # semi-colons;
+ # periods.
+ _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;\.]|' +
r'[A-Za-z_][\w\.]*|/\*|\*/|\[\])')
class OuterState:
self.skipState = ret
return ret
+ def openBracket(self):
+ self.brackets = self.brackets + 1
+
+ def closeBracket(self):
+ self.brackets = self.brackets - 1
+ if len(self.stackBrackets) and \
+ self.brackets == self.stackBrackets[-1]:
+ self.listOutputs.append(string.join(self.listClasses, '$'))
+ self.listClasses.pop()
+ self.stackBrackets.pop()
+
def parseToken(self, token):
if token[:2] == '//':
return IgnoreState('\n', self)
elif token == '/*':
return IgnoreState('*/', self)
elif token == '{':
- self.brackets = self.brackets + 1
+ self.openBracket()
elif token == '}':
- self.brackets = self.brackets - 1
- if len(self.stackBrackets) and \
- self.brackets == self.stackBrackets[-1]:
- self.listOutputs.append(string.join(self.listClasses, '$'))
- self.listClasses.pop()
- self.stackBrackets.pop()
+ self.closeBracket()
elif token in [ '"', "'" ]:
return IgnoreState(token, self)
elif token == "new":
return self.__getClassState()
elif token == 'package':
return self.__getPackageState()
+ elif token == '.':
+ # Skip the attribute, it might be named "class", in which
+ # case we don't want to treat the following token as
+ # an inner class name...
+ return self.__getSkipState()
return self
def addAnonClass(self):
"""Add an anonymous inner class"""
clazz = self.listClasses[0]
self.listOutputs.append('%s$%d' % (clazz, self.nextAnon))
- self.brackets = self.brackets + 1
self.nextAnon = self.nextAnon + 1
def setPackage(self, package):
if token == '\n':
return self
if token == '{':
+ self.outer_state.openBracket()
self.outer_state.addAnonClass()
+ elif token == '}':
+ self.outer_state.closeBracket()
elif token in ['"', "'"]:
return IgnoreState(token, self)
return self.outer_state
assert classes == ['TestClass$1', 'TestClass$2', 'TestClass'], classes
+ def test_closing_bracket(self):
+ """Test finding a closing bracket instead of an anonymous class"""
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+class TestSCons {
+ public static void main(String[] args) {
+ Foo[] fooArray = new Foo[] { new Foo() };
+ }
+}
+
+class Foo { }
+""")
+ assert pkg_dir == None, pkg_dir
+ assert classes == ['TestSCons', 'Foo'], classes
+
+
+ def test_dot_class_attributes(self):
+ """Test handling ".class" attributes"""
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+public class Test extends Object
+{
+ static {
+ Class c = Object[].class;
+ Object[] s = new Object[] {};
+ }
+}
+""")
+ assert classes == ['Test'], classes
+
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+public class A {
+ public class B {
+ public void F(Object[] o) {
+ F(new Object[] {Object[].class});
+ }
+ public void G(Object[] o) {
+ F(new Object[] {});
+ }
+ }
+}
+""")
+ assert pkg_dir == None, pkg_dir
+ assert classes == ['A$B', 'A'], classes
+
+
if __name__ == "__main__":
suite = unittest.TestSuite()
<summary>
The string displayed when
fetching a source file from Perforce.
-If this is not set, then &cv-P4COM; (the command line) is displayed.
+If this is not set, then &cv-link-P4COM; (the command line) is displayed.
</summary>
</cvar>
Note that this variable is not actually used
for the command to fetch source files from RCS;
see the
-&cv-RCS_CO;
+&cv-link-RCS_CO;
construction variable, below.
</summary>
</cvar>
<summary>
The string displayed when fetching
a source file from RCS.
-If this is not set, then &cv-RCS_COCOM;
+If this is not set, then &cv-link-RCS_COCOM;
(the command line) is displayed.
</summary>
</cvar>
<cvar name="RCS_COFLAGS">
<summary>
-Options that are passed to the &cv-RCS_CO; command.
+Options that are passed to the &cv-link-RCS_CO; command.
</summary>
</cvar>
<summary>
The string displayed when fetching
a source file from a CVS repository.
-If this is not set, then &cv-SCCSCOM;
+If this is not set, then &cv-link-SCCSCOM;
(the command line) is displayed.
</summary>
</cvar>
<summary>
Builds a C source file given a lex (<filename>.l</filename>)
or yacc (<filename>.y</filename>) input file.
-The suffix specified by the &cv-CFILESUFFIX; construction variable
+The suffix specified by the &cv-link-CFILESUFFIX; construction variable
(<filename>.c</filename> by default)
is automatically added to the target
if it is not already present.
Builds a C++ source file given a lex (<filename>.ll</filename>)
or yacc (<filename>.yy</filename>)
input file.
-The suffix specified by the &cv-CXXFILESUFFIX; construction variable
+The suffix specified by the &cv-link-CXXFILESUFFIX; construction variable
(<filename>.cc</filename> by default)
is automatically added to the target
if it is not already present.
a list of legal source file suffixes
and how they are interpreted.
The target executable file prefix
-(specified by the &cv-PROGPREFIX; construction variable; nothing by default)
+(specified by the &cv-link-PROGPREFIX; construction variable; nothing by default)
and suffix
-(specified by the &cv-PROGSUFFIX; construction variable;
+(specified by the &cv-link-PROGSUFFIX; construction variable;
by default, <filename>.exe</filename> on Windows systems,
nothing on POSIX systems)
are automatically added to the target if not already present.
The static library prefix and suffix (if any)
are automatically added to the target.
The target library file prefix
-(specified by the &cv-SHLIBPREFIX; construction variable;
+(specified by the &cv-link-SHLIBPREFIX; construction variable;
by default, <filename>lib</filename> on POSIX systems,
nothing on Windows systems)
and suffix
-(specified by the &cv-SHLIBSUFFIX; construction variable;
+(specified by the &cv-link-SHLIBSUFFIX; construction variable;
by default, <filename>.dll</filename> on Windows systems,
<filename>.so</filename> on POSIX systems)
are automatically added to the target if not already present.
will cause the <filename>.dll</filename> to be
registered after it is built using REGSVR32.
The command that is run
-("regsvr32" by default) is determined by &cv-REGSVR; construction
-variable, and the flags passed are determined by &cv-REGSVRFLAGS;. By
-default, &cv-REGSVRFLAGS; includes the <option>/s</option> option,
+("regsvr32" by default) is determined by &cv-link-REGSVR; construction
+variable, and the flags passed are determined by &cv-link-REGSVRFLAGS;. By
+default, &cv-link-REGSVRFLAGS; includes the <option>/s</option> option,
to prevent dialogs from popping
up and requiring user attention when it is run. If you change
-&cv-REGSVRFLAGS;, be sure to include the <option>/s</option> option.
+&cv-link-REGSVRFLAGS;, be sure to include the <option>/s</option> option.
For example,
<example>
shared library, and will use the same suffix for shared and normal
(static) objects.
The target object file prefix
-(specified by the &cv-SHOBJPREFIX; construction variable;
-by default, the same as &cv-OBJPREFIX;)
+(specified by the &cv-link-SHOBJPREFIX; construction variable;
+by default, the same as &cv-link-OBJPREFIX;)
and suffix
-(specified by the &cv-SHOBJSUFFIX; construction variable)
+(specified by the &cv-link-SHOBJSUFFIX; construction variable)
are automatically added to the target if not already present.
Examples:
The static library prefix and suffix (if any)
are automatically added to the target.
The target library file prefix
-(specified by the &cv-LIBPREFIX; construction variable;
+(specified by the &cv-link-LIBPREFIX; construction variable;
by default, <filename>lib</filename> on POSIX systems,
nothing on Windows systems)
and suffix
-(specified by the &cv-LIBSUFFIX; construction variable;
+(specified by the &cv-link-LIBSUFFIX; construction variable;
by default, <filename>.lib</filename> on Windows systems,
<filename>.a</filename> on POSIX systems)
are automatically added to the target if not already present.
</example>
The target object file prefix
-(specified by the &cv-OBJPREFIX; construction variable; nothing by default)
+(specified by the &cv-link-OBJPREFIX; construction variable; nothing by default)
and suffix
-(specified by the &cv-OBJSUFFIX; construction variable;
+(specified by the &cv-link-OBJSUFFIX; construction variable;
<filename>.obj</filename> on Windows systems,
<filename>.o</filename> on POSIX systems)
are automatically added to the target if not already present.
the end of a command
line building a loadable module.
(This has been largely superceded by
-the &cv-FRAMEWORKPATH;, &cv-FRAMEWORKPATHPREFIX;,
-&cv-FRAMEWORKPREFIX; and &cv-FRAMEWORKS; variables
+the &cv-link-FRAMEWORKPATH;, &cv-link-FRAMEWORKPATHPREFIX;,
+&cv-link-FRAMEWORKPREFIX; and &cv-link-FRAMEWORKS; variables
described above.)
</summary>
</cvar>
<summary>
On Mac OS X with gcc,
the prefix to be used for linking in frameworks
-(see &cv-FRAMEWORKS;).
+(see &cv-link-FRAMEWORKS;).
The default value is
<option>-framework</option>.
</summary>
Used by the compiler to find framework-style includes like
#include <Fmwk/Header.h>.
Used by the linker to find user-specified frameworks when linking (see
-&cv-FRAMEWORKS;).
+&cv-link-FRAMEWORKS;).
For example:
<example>
<cvar name="FRAMEWORKPATHPREFIX">
<summary>
On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries.
-(see &cv-FRAMEWORKPATH;).
+(see &cv-link-FRAMEWORKPATH;).
The default value is
<option>-F</option>.
</summary>
<summary>
On Mac OS X with gcc, an automatically-generated construction variable
containing the linker command-line options corresponding to
-&cv-FRAMEWORKPATH;.
+&cv-link-FRAMEWORKPATH;.
</summary>
</cvar>
<summary>
The string displayed when an object file
is generated from an assembly-language source file.
-If this is not set, then &cv-ARCOM; (the command line) is displayed.
+If this is not set, then &cv-link-ARCOM; (the command line) is displayed.
<example>
env = Environment(ARCOMSTR = "Archiving $TARGET")
<cvar name="RANLIBCOMSTR">
<summary>
The string displayed when a static library archive is indexed.
-If this is not set, then &cv-RANLIBCOM; (the command line) is displayed.
+If this is not set, then &cv-link-RANLIBCOM; (the command line) is displayed.
<example>
env = Environment(RANLIBCOMSTR = "Indexing $TARGET")
<summary>
The string displayed when an object file
is generated from an assembly-language source file.
-If this is not set, then &cv-ASCOM; (the command line) is displayed.
+If this is not set, then &cv-link-ASCOM; (the command line) is displayed.
<example>
env = Environment(ASCOMSTR = "Assembling $TARGET")
The command line used to assemble an assembly-language
source file into an object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-ASFLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified
+in the &cv-link-ASFLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
</summary>
</cvar>
The string displayed when an object file
is generated from an assembly-language source file
after first running the file through the C preprocessor.
-If this is not set, then &cv-ASPPCOM; (the command line) is displayed.
+If this is not set, then &cv-link-ASPPCOM; (the command line) is displayed.
<example>
env = Environment(ASPPCOMSTR = "Assembling $TARGET")
General options when an assembling an assembly-language
source file into an object file
after first running the file through the C preprocessor.
-The default is to use the value of &cv-ASFLAGS;.
+The default is to use the value of &cv-link-ASFLAGS;.
</summary>
</cvar>
<cvar name="CXXCOM">
<summary>
The command line used to compile a C++ source file to an object file.
-Any options specified in the &cv-CXXFLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-CXXFLAGS; and
+&cv-link-CPPFLAGS; construction variables
are included on this command line.
</summary>
</cvar>
<summary>
The string displayed when a C++ source file
is compiled to a (static) object file.
-If this is not set, then &cv-CXXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-CXXCOM; (the command line) is displayed.
<example>
env = Environment(CXXCOMSTR = "Compiling static object $TARGET")
<cvar name="CXXFLAGS">
<summary>
General options that are passed to the C++ compiler.
-By default, this includes the value of &cv-CCFLAGS;,
+By default, this includes the value of &cv-link-CCFLAGS;,
so that setting &cv-CCFLAGS; affects both C and C++ compilation.
If you want to add C++-specific flags,
-you must set or override the value of &cv-CXXFLAGS;.
+you must set or override the value of &cv-link-CXXFLAGS;.
</summary>
</cvar>
<summary>
The command line used to compile a C++ source file
to a shared-library object file.
-Any options specified in the &cv-SHCXXFLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-SHCXXFLAGS; and
+&cv-link-CPPFLAGS; construction variables
are included on this command line.
</summary>
</cvar>
<summary>
The string displayed when a C++ source file
is compiled to a shared object file.
-If this is not set, then &cv-SHCXXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-SHCXXCOM; (the command line) is displayed.
<example>
env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET")
-->
<tool name="cc">
<summary>
-XXX
+&cv-link-CC;
+&cv-link-CFLAGS;
+&cv-link-CCCOM;
+&cv-link-SHCC;
+&cv-link-SHCFLAGS;
+&cv-link-SHCCCOM;
+
+&cv-link-CPPDEFPREFIX;
+&cv-link-CPPDEFSUFFIX;
+&cv-link-INCPREFIX;
+&cv-link-INCSUFFIX;
+&cv-link-SHOBJSUFFIX;
+<!-- &cv-link-STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME; -->
+
+&cv-link-CFILESUFFIX;
</summary>
</tool>
<cvar name="CCCOM">
<summary>
The command line used to compile a C source file to a (static) object
-file. Any options specified in the &cv-CFLAGS;, &cv-CCFLAGS; and
-&cv-CPPFLAGS; construction variables are included on this command
+file. Any options specified in the &cv-link-CFLAGS;, &cv-link-CCFLAGS; and
+&cv-link-CPPFLAGS; construction variables are included on this command
line.
</summary>
</cvar>
<summary>
The string displayed when a C source file
is compiled to a (static) object file.
-If this is not set, then &cv-CCCOM; (the command line) is displayed.
+If this is not set, then &cv-link-CCCOM; (the command line) is displayed.
<example>
env = Environment(CCCOMSTR = "Compiling static object $TARGET")
User-specified C preprocessor options.
These will be included in any command that uses the C preprocessor,
including not just compilation of C and C++ source files
-via the &cv-CCCOM;, &cv-SHCCCOM;, &cv-CXXCOM; and &cv-SHCXXCOM; command lines,
-but also the &cv-FORTRANPPCOM;, &cv-SHFORTRANPPCOM;,
-&cv-F77PPCOM; and &cv-SHF77PPCOM; command lines
+via the &cv-link-CCCOM;,
+&cv-link-SHCCCOM;,
+&cv-link-CXXCOM; and
+&cv-link-SHCXXCOM; command lines,
+but also the &cv-link-FORTRANPPCOM;,
+&cv-link-SHFORTRANPPCOM;,
+&cv-link-F77PPCOM; and
+&cv-link-SHF77PPCOM; command lines
used to compile a Fortran source file,
-and the &cv-ASPPCOM; command line
+and the &cv-link-ASPPCOM; command line
used to assemble an assembly language source file,
after first running each file through the C preprocessor.
Note that this variable does
contain
<option>-I</option>
(or similar) include search path options
-that scons generates automatically from &cv-CPPPATH;.
+that scons generates automatically from &cv-link-CPPPATH;.
See &cv-link-_CPPINCFLAGS;, below,
for the variable that expands to those options.
</summary>
<summary>
The command line used to compile a C source file
to a shared-library object file.
-Any options specified in the &cv-SHCFLAGS;, &cv-SHCCFLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-SHCFLAGS;,
+&cv-link-SHCCFLAGS; and
+&cv-link-CPPFLAGS; construction variables
are included on this command line.
</summary>
</cvar>
<summary>
The string displayed when a C source file
is compiled to a shared object file.
-If this is not set, then &cv-SHCCCOM; (the command line) is displayed.
+If this is not set, then &cv-link-SHCCCOM; (the command line) is displayed.
<example>
env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET")
or
<literal>\documentstyle</literal>
is found, the file is assumed to be a LaTeX file and
-the target is built by invoking the &cv-LATEXCOM; command line;
-otherwise, the &cv-TEXCOM; command line is used.
+the target is built by invoking the &cv-link-LATEXCOM; command line;
+otherwise, the &cv-link-TEXCOM; command line is used.
If the file is a LaTeX file,
the
&b-DVI;
builder method will also examine the contents
of the
<filename>.aux</filename>
-file and invoke the &cv-BIBTEX; command line
+file and invoke the &cv-link-BIBTEX; command line
if the string
<literal>bibdata</literal>
is found,
-start &cv-MAKEINDEX; to generate an index if a
+start &cv-link-MAKEINDEX; to generate an index if a
<filename>.ind</filename>
file is found
and will examine the contents
<filename>.log</filename>
-file and re-run the &cv-LATEXCOM; command
+file and re-run the &cv-link-LATEXCOM; command
if the log file says it is necessary.
The suffix <filename>.dvi</filename>
<summary>
The string displayed when a TeX DVI file
is converted into a PDF file.
-If this is not set, then &cv-DVIPDFCOM; (the command line) is displayed.
+If this is not set, then &cv-link-DVIPDFCOM; (the command line) is displayed.
</summary>
</cvar>
<cvar name="PDFCOM">
<summary>
-A deprecated synonym for &cv-DVIPDFCOM;.
+A deprecated synonym for &cv-link-DVIPDFCOM;.
</summary>
</cvar>
<filename>.ltx</filename>,
or
<filename>.latex</filename> input file).
-The suffix specified by the &cv-PSSUFFIX; construction variable
+The suffix specified by the &cv-link-PSSUFFIX; construction variable
(<filename>.ps</filename> by default)
is added automatically to the target
if it is not already present. Example:
<summary>
The string displayed when a TeX DVI file
is converted into a PostScript file.
-If this is not set, then &cv-PSCOM; (the command line) is displayed.
+If this is not set, then &cv-link-PSCOM; (the command line) is displayed.
</summary>
</cvar>
<cvar name="F77">
<summary>
The Fortran 77 compiler.
-You should normally set the &cv-FORTRAN; variable,
+You should normally set the &cv-link-FORTRAN; variable,
which specifies the default Fortran compiler
for all Fortran versions.
-You only need to set &cv-F77; if you need to use a specific compiler
+You only need to set &cv-link-F77; if you need to use a specific compiler
or compiler version for Fortran 77 files.
</summary>
</cvar>
<cvar name="F77COM">
<summary>
The command line used to compile a Fortran 77 source file to an object file.
-You only need to set &cv-F77COM; if you need to use a specific
+You only need to set &cv-link-F77COM; if you need to use a specific
command line for Fortran 77 files.
-You should normally set the &cv-FORTRANCOM; variable,
+You should normally set the &cv-link-FORTRANCOM; variable,
which specifies the default command line
for all Fortran versions.
</summary>
<summary>
The string displayed when a Fortran 77 source file
is compiled to an object file.
-If this is not set, then &cv-F77COM; or &cv-FORTRANCOM;
+If this is not set, then &cv-link-F77COM; or &cv-link-FORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
contain
<option>-I</option>
(or similar) include search path options
-that scons generates automatically from &cv-F77PATH;.
+that scons generates automatically from &cv-link-F77PATH;.
See
-&cv-_F77INCFLAGS;
+&cv-link-_F77INCFLAGS;
below,
for the variable that expands to those options.
-You only need to set &cv-F77FLAGS; if you need to define specific
+You only need to set &cv-link-F77FLAGS; if you need to define specific
user options for Fortran 77 files.
-You should normally set the &cv-FORTRANFLAGS; variable,
+You should normally set the &cv-link-FORTRANFLAGS; variable,
which specifies the user-specified options
passed to the default Fortran compiler
for all Fortran versions.
An automatically-generated construction variable
containing the Fortran 77 compiler command-line options
for specifying directories to be searched for include files.
-The value of &cv-_F77INCFLAGS; is created
-by appending &cv-INCPREFIX; and &cv-INCSUFFIX;
+The value of &cv-link-_F77INCFLAGS; is created
+by appending &cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
to the beginning and end
-of each directory in &cv-F77PATH;.
+of each directory in &cv-link-F77PATH;.
</summary>
</cvar>
The list of directories that the Fortran 77 compiler will search for include
directories. The implicit dependency scanner will search these
directories for include files. Don't explicitly put include directory
-arguments in &cv-F77FLAGS; because the result will be non-portable
+arguments in &cv-link-F77FLAGS; because the result will be non-portable
and the directories will not be searched by the dependency scanner. Note:
-directory names in &cv-F77PATH; will be looked-up relative to the SConscript
+directory names in &cv-link-F77PATH; will be looked-up relative to the SConscript
directory when they are used in a command. To force
&scons;
to look-up a directory relative to the root of the source tree use #:
-You only need to set &cv-F77PATH; if you need to define a specific
+You only need to set &cv-link-F77PATH; if you need to define a specific
include path for Fortran 77 files.
-You should normally set the &cv-FORTRANPATH; variable,
+You should normally set the &cv-link-FORTRANPATH; variable,
which specifies the include path
for the default Fortran compiler
for all Fortran versions.
The directory list will be added to command lines
through the automatically-generated
-&cv-_F77INCFLAGS;
+&cv-link-_F77INCFLAGS;
construction variable,
which is constructed by
appending the values of the
-&cv-INCPREFIX; and &cv-INCSUFFIX;
+&cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
construction variables
to the beginning and end
-of each directory in &cv-F77PATH;.
+of each directory in &cv-link-F77PATH;.
Any command lines you define that need
the F77PATH directory list should
-include &cv-_F77INCFLAGS;:
+include &cv-link-_F77INCFLAGS;:
<example>
env = Environment(F77COM="my_compiler $_F77INCFLAGS -c -o $TARGET $SOURCE")
<summary>
The command line used to compile a Fortran 77 source file to an object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-F77FLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-F77FLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
-You only need to set &cv-F77PPCOM; if you need to use a specific
+You only need to set &cv-link-F77PPCOM; if you need to use a specific
C-preprocessor command line for Fortran 77 files.
-You should normally set the &cv-FORTRANPPCOM; variable,
+You should normally set the &cv-link-FORTRANPPCOM; variable,
which specifies the default C-preprocessor command line
for all Fortran versions.
</summary>
<cvar name="SHF77">
<summary>
The Fortran 77 compiler used for generating shared-library objects.
-You should normally set the &cv-SHFORTRAN; variable,
+You should normally set the &cv-link-SHFORTRAN; variable,
which specifies the default Fortran compiler
for all Fortran versions.
-You only need to set &cv-SHF77; if you need to use a specific compiler
+You only need to set &cv-link-SHF77; if you need to use a specific compiler
or compiler version for Fortran 77 files.
</summary>
</cvar>
<summary>
The command line used to compile a Fortran 77 source file
to a shared-library object file.
-You only need to set &cv-SHF77COM; if you need to use a specific
+You only need to set &cv-link-SHF77COM; if you need to use a specific
command line for Fortran 77 files.
-You should normally set the &cv-SHFORTRANCOM; variable,
+You should normally set the &cv-link-SHFORTRANCOM; variable,
which specifies the default command line
for all Fortran versions.
</summary>
<summary>
The string displayed when a Fortran 77 source file
is compiled to a shared-library object file.
-If this is not set, then &cv-SHF77COM; or &cv-SHFORTRANCOM;
+If this is not set, then &cv-link-SHF77COM; or &cv-link-SHFORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
<summary>
Options that are passed to the Fortran 77 compiler
to generated shared-library objects.
-You only need to set &cv-SHF77FLAGS; if you need to define specific
+You only need to set &cv-link-SHF77FLAGS; if you need to define specific
user options for Fortran 77 files.
-You should normally set the &cv-SHFORTRANFLAGS; variable,
+You should normally set the &cv-link-SHFORTRANFLAGS; variable,
which specifies the user-specified options
passed to the default Fortran compiler
for all Fortran versions.
The command line used to compile a Fortran 77 source file to a
shared-library object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-SHF77FLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-SHF77FLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
-You only need to set &cv-SHF77PPCOM; if you need to use a specific
+You only need to set &cv-link-SHF77PPCOM; if you need to use a specific
C-preprocessor command line for Fortran 77 files.
-You should normally set the &cv-SHFORTRANPPCOM; variable,
+You should normally set the &cv-link-SHFORTRANPPCOM; variable,
which specifies the default C-preprocessor command line
for all Fortran versions.
</summary>
<cvar name="F90">
<summary>
The Fortran 90 compiler.
-You should normally set the &cv-FORTRAN; variable,
+You should normally set the &cv-link-FORTRAN; variable,
which specifies the default Fortran compiler
for all Fortran versions.
-You only need to set &cv-F90; if you need to use a specific compiler
+You only need to set &cv-link-F90; if you need to use a specific compiler
or compiler version for Fortran 90 files.
</summary>
</cvar>
<cvar name="F90COM">
<summary>
The command line used to compile a Fortran 90 source file to an object file.
-You only need to set &cv-F90COM; if you need to use a specific
+You only need to set &cv-link-F90COM; if you need to use a specific
command line for Fortran 90 files.
-You should normally set the &cv-FORTRANCOM; variable,
+You should normally set the &cv-link-FORTRANCOM; variable,
which specifies the default command line
for all Fortran versions.
</summary>
<summary>
The string displayed when a Fortran 90 source file
is compiled to an object file.
-If this is not set, then &cv-F90COM; or &cv-FORTRANCOM;
+If this is not set, then &cv-link-F90COM; or &cv-link-FORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
contain
<option>-I</option>
(or similar) include search path options
-that scons generates automatically from &cv-F90PATH;.
+that scons generates automatically from &cv-link-F90PATH;.
See
-&cv-_F90INCFLAGS;
+&cv-link-_F90INCFLAGS;
below,
for the variable that expands to those options.
-You only need to set &cv-F90FLAGS; if you need to define specific
+You only need to set &cv-link-F90FLAGS; if you need to define specific
user options for Fortran 90 files.
-You should normally set the &cv-FORTRANFLAGS; variable,
+You should normally set the &cv-link-FORTRANFLAGS; variable,
which specifies the user-specified options
passed to the default Fortran compiler
for all Fortran versions.
An automatically-generated construction variable
containing the Fortran 90 compiler command-line options
for specifying directories to be searched for include files.
-The value of &cv-_F90INCFLAGS; is created
-by appending &cv-INCPREFIX; and &cv-INCSUFFIX;
+The value of &cv-link-_F90INCFLAGS; is created
+by appending &cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
to the beginning and end
-of each directory in &cv-F90PATH;.
+of each directory in &cv-link-F90PATH;.
</summary>
</cvar>
The list of directories that the Fortran 90 compiler will search for include
directories. The implicit dependency scanner will search these
directories for include files. Don't explicitly put include directory
-arguments in &cv-F90FLAGS; because the result will be non-portable
+arguments in &cv-link-F90FLAGS; because the result will be non-portable
and the directories will not be searched by the dependency scanner. Note:
-directory names in &cv-F90PATH; will be looked-up relative to the SConscript
+directory names in &cv-link-F90PATH; will be looked-up relative to the SConscript
directory when they are used in a command. To force
&scons;
to look-up a directory relative to the root of the source tree use #:
-You only need to set &cv-F90PATH; if you need to define a specific
+You only need to set &cv-link-F90PATH; if you need to define a specific
include path for Fortran 90 files.
-You should normally set the &cv-FORTRANPATH; variable,
+You should normally set the &cv-link-FORTRANPATH; variable,
which specifies the include path
for the default Fortran compiler
for all Fortran versions.
The directory list will be added to command lines
through the automatically-generated
-&cv-_F90INCFLAGS;
+&cv-link-_F90INCFLAGS;
construction variable,
which is constructed by
appending the values of the
-&cv-INCPREFIX; and &cv-INCSUFFIX;
+&cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
construction variables
to the beginning and end
-of each directory in &cv-F90PATH;.
+of each directory in &cv-link-F90PATH;.
Any command lines you define that need
the F90PATH directory list should
-include &cv-_F90INCFLAGS;:
+include &cv-link-_F90INCFLAGS;:
<example>
env = Environment(F90COM="my_compiler $_F90INCFLAGS -c -o $TARGET $SOURCE")
<summary>
The command line used to compile a Fortran 90 source file to an object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-F90FLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-F90FLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
-You only need to set &cv-F90PPCOM; if you need to use a specific
+You only need to set &cv-link-F90PPCOM; if you need to use a specific
C-preprocessor command line for Fortran 90 files.
-You should normally set the &cv-FORTRANPPCOM; variable,
+You should normally set the &cv-link-FORTRANPPCOM; variable,
which specifies the default C-preprocessor command line
for all Fortran versions.
</summary>
<cvar name="SHF90">
<summary>
The Fortran 90 compiler used for generating shared-library objects.
-You should normally set the &cv-SHFORTRAN; variable,
+You should normally set the &cv-link-SHFORTRAN; variable,
which specifies the default Fortran compiler
for all Fortran versions.
-You only need to set &cv-SHF90; if you need to use a specific compiler
+You only need to set &cv-link-SHF90; if you need to use a specific compiler
or compiler version for Fortran 90 files.
</summary>
</cvar>
<summary>
The command line used to compile a Fortran 90 source file
to a shared-library object file.
-You only need to set &cv-SHF90COM; if you need to use a specific
+You only need to set &cv-link-SHF90COM; if you need to use a specific
command line for Fortran 90 files.
-You should normally set the &cv-SHFORTRANCOM; variable,
+You should normally set the &cv-link-SHFORTRANCOM; variable,
which specifies the default command line
for all Fortran versions.
</summary>
<summary>
The string displayed when a Fortran 90 source file
is compiled to a shared-library object file.
-If this is not set, then &cv-SHF90COM; or &cv-SHFORTRANCOM;
+If this is not set, then &cv-link-SHF90COM; or &cv-link-SHFORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
<summary>
Options that are passed to the Fortran 90 compiler
to generated shared-library objects.
-You only need to set &cv-SHF90FLAGS; if you need to define specific
+You only need to set &cv-link-SHF90FLAGS; if you need to define specific
user options for Fortran 90 files.
-You should normally set the &cv-SHFORTRANFLAGS; variable,
+You should normally set the &cv-link-SHFORTRANFLAGS; variable,
which specifies the user-specified options
passed to the default Fortran compiler
for all Fortran versions.
The command line used to compile a Fortran 90 source file to a
shared-library object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-SHF90FLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-SHF90FLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
-You only need to set &cv-SHF90PPCOM; if you need to use a specific
+You only need to set &cv-link-SHF90PPCOM; if you need to use a specific
C-preprocessor command line for Fortran 90 files.
-You should normally set the &cv-SHFORTRANPPCOM; variable,
+You should normally set the &cv-link-SHFORTRANPPCOM; variable,
which specifies the default C-preprocessor command line
for all Fortran versions.
</summary>
<cvar name="F95">
<summary>
The Fortran 95 compiler.
-You should normally set the &cv-FORTRAN; variable,
+You should normally set the &cv-link-FORTRAN; variable,
which specifies the default Fortran compiler
for all Fortran versions.
-You only need to set &cv-F95; if you need to use a specific compiler
+You only need to set &cv-link-F95; if you need to use a specific compiler
or compiler version for Fortran 95 files.
</summary>
</cvar>
<cvar name="F95COM">
<summary>
The command line used to compile a Fortran 95 source file to an object file.
-You only need to set &cv-F95COM; if you need to use a specific
+You only need to set &cv-link-F95COM; if you need to use a specific
command line for Fortran 95 files.
-You should normally set the &cv-FORTRANCOM; variable,
+You should normally set the &cv-link-FORTRANCOM; variable,
which specifies the default command line
for all Fortran versions.
</summary>
<summary>
The string displayed when a Fortran 95 source file
is compiled to an object file.
-If this is not set, then &cv-F95COM; or &cv-FORTRANCOM;
+If this is not set, then &cv-link-F95COM; or &cv-link-FORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
contain
<option>-I</option>
(or similar) include search path options
-that scons generates automatically from &cv-F95PATH;.
+that scons generates automatically from &cv-link-F95PATH;.
See
-&cv-_F95INCFLAGS;
+&cv-link-_F95INCFLAGS;
below,
for the variable that expands to those options.
-You only need to set &cv-F95FLAGS; if you need to define specific
+You only need to set &cv-link-F95FLAGS; if you need to define specific
user options for Fortran 95 files.
-You should normally set the &cv-FORTRANFLAGS; variable,
+You should normally set the &cv-link-FORTRANFLAGS; variable,
which specifies the user-specified options
passed to the default Fortran compiler
for all Fortran versions.
An automatically-generated construction variable
containing the Fortran 95 compiler command-line options
for specifying directories to be searched for include files.
-The value of &cv-_F95INCFLAGS; is created
-by appending &cv-INCPREFIX; and &cv-INCSUFFIX;
+The value of &cv-link-_F95INCFLAGS; is created
+by appending &cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
to the beginning and end
-of each directory in &cv-F95PATH;.
+of each directory in &cv-link-F95PATH;.
</summary>
</cvar>
The list of directories that the Fortran 95 compiler will search for include
directories. The implicit dependency scanner will search these
directories for include files. Don't explicitly put include directory
-arguments in &cv-F95FLAGS; because the result will be non-portable
+arguments in &cv-link-F95FLAGS; because the result will be non-portable
and the directories will not be searched by the dependency scanner. Note:
-directory names in &cv-F95PATH; will be looked-up relative to the SConscript
+directory names in &cv-link-F95PATH; will be looked-up relative to the SConscript
directory when they are used in a command. To force
&scons;
to look-up a directory relative to the root of the source tree use #:
-You only need to set &cv-F95PATH; if you need to define a specific
+You only need to set &cv-link-F95PATH; if you need to define a specific
include path for Fortran 95 files.
-You should normally set the &cv-FORTRANPATH; variable,
+You should normally set the &cv-link-FORTRANPATH; variable,
which specifies the include path
for the default Fortran compiler
for all Fortran versions.
The directory list will be added to command lines
through the automatically-generated
-&cv-_F95INCFLAGS;
+&cv-link-_F95INCFLAGS;
construction variable,
which is constructed by
appending the values of the
-&cv-INCPREFIX; and &cv-INCSUFFIX;
+&cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
construction variables
to the beginning and end
-of each directory in &cv-F95PATH;.
+of each directory in &cv-link-F95PATH;.
Any command lines you define that need
the F95PATH directory list should
-include &cv-_F95INCFLAGS;:
+include &cv-link-_F95INCFLAGS;:
<example>
env = Environment(F95COM="my_compiler $_F95INCFLAGS -c -o $TARGET $SOURCE")
<summary>
The command line used to compile a Fortran 95 source file to an object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-F95FLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-F95FLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
-You only need to set &cv-F95PPCOM; if you need to use a specific
+You only need to set &cv-link-F95PPCOM; if you need to use a specific
C-preprocessor command line for Fortran 95 files.
-You should normally set the &cv-FORTRANPPCOM; variable,
+You should normally set the &cv-link-FORTRANPPCOM; variable,
which specifies the default C-preprocessor command line
for all Fortran versions.
</summary>
<cvar name="SHF95">
<summary>
The Fortran 95 compiler used for generating shared-library objects.
-You should normally set the &cv-SHFORTRAN; variable,
+You should normally set the &cv-link-SHFORTRAN; variable,
which specifies the default Fortran compiler
for all Fortran versions.
-You only need to set &cv-SHF95; if you need to use a specific compiler
+You only need to set &cv-link-SHF95; if you need to use a specific compiler
or compiler version for Fortran 95 files.
</summary>
</cvar>
<summary>
The command line used to compile a Fortran 95 source file
to a shared-library object file.
-You only need to set &cv-SHF95COM; if you need to use a specific
+You only need to set &cv-link-SHF95COM; if you need to use a specific
command line for Fortran 95 files.
-You should normally set the &cv-SHFORTRANCOM; variable,
+You should normally set the &cv-link-SHFORTRANCOM; variable,
which specifies the default command line
for all Fortran versions.
</summary>
<summary>
The string displayed when a Fortran 95 source file
is compiled to a shared-library object file.
-If this is not set, then &cv-SHF95COM; or &cv-SHFORTRANCOM;
+If this is not set, then &cv-link-SHF95COM; or &cv-link-SHFORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
<summary>
Options that are passed to the Fortran 95 compiler
to generated shared-library objects.
-You only need to set &cv-SHF95FLAGS; if you need to define specific
+You only need to set &cv-link-SHF95FLAGS; if you need to define specific
user options for Fortran 95 files.
-You should normally set the &cv-SHFORTRANFLAGS; variable,
+You should normally set the &cv-link-SHFORTRANFLAGS; variable,
which specifies the user-specified options
passed to the default Fortran compiler
for all Fortran versions.
The command line used to compile a Fortran 95 source file to a
shared-library object file
after first running the file through the C preprocessor.
-Any options specified in the &cv-SHF95FLAGS; and &cv-CPPFLAGS; construction variables
+Any options specified in the &cv-link-SHF95FLAGS; and &cv-link-CPPFLAGS; construction variables
are included on this command line.
-You only need to set &cv-SHF95PPCOM; if you need to use a specific
+You only need to set &cv-link-SHF95PPCOM; if you need to use a specific
C-preprocessor command line for Fortran 95 files.
-You should normally set the &cv-SHFORTRANPPCOM; variable,
+You should normally set the &cv-link-SHFORTRANPPCOM; variable,
which specifies the default C-preprocessor command line
for all Fortran versions.
</summary>
<summary>
The command line used to compile a Fortran source file to an object file.
By default, any options specified
-in the &cv-FORTRANFLAGS;, &cv-CPPFLAGS;, &cv-_CPPDEFFLAGS;,
-&cv-_FORTRANMODFLAG;, and &cv-_FORTRANINCFLAGS; construction variables
+in the &cv-link-FORTRANFLAGS;,
+&cv-link-CPPFLAGS;,
+&cv-link-_CPPDEFFLAGS;,
+&cv-link-_FORTRANMODFLAG;, and
+&cv-link-_FORTRANINCFLAGS; construction variables
are included on this command line.
</summary>
</cvar>
<summary>
The string displayed when a Fortran source file
is compiled to an object file.
-If this is not set, then &cv-FORTRANCOM;
+If this is not set, then &cv-link-FORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
contain
<option>-I</option>
(or similar) include or module search path options
-that scons generates automatically from &cv-FORTRANPATH;.
+that scons generates automatically from &cv-link-FORTRANPATH;.
See
-&cv-_FORTRANINCFLAGS; and &cv-_FORTRANMODFLAG;,
+&cv-link-_FORTRANINCFLAGS; and &cv-link-_FORTRANMODFLAG;,
below,
for the variables that expand those options.
</summary>
containing the Fortran compiler command-line options
for specifying directories to be searched for include
files and module files.
-The value of &cv-_FORTRANINCFLAGS; is created
-by prepending/appending &cv-INCPREFIX; and &cv-INCSUFFIX;
+The value of &cv-link-_FORTRANINCFLAGS; is created
+by prepending/appending &cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
to the beginning and end
-of each directory in &cv-FORTRANPATH;.
+of each directory in &cv-link-FORTRANPATH;.
</summary>
</cvar>
The prefix used to specify a module directory on the Fortran compiler command
line.
This will be appended to the beginning of the directory
-in the &cv-FORTRANMODDIR; construction variables
-when the &cv-_FORTRANMODFLAG; variables is automatically generated.
+in the &cv-link-FORTRANMODDIR; construction variables
+when the &cv-link-_FORTRANMODFLAG; variables is automatically generated.
</summary>
</cvar>
The suffix used to specify a module directory on the Fortran compiler command
line.
This will be appended to the beginning of the directory
-in the &cv-FORTRANMODDIR; construction variables
-when the &cv-_FORTRANMODFLAG; variables is automatically generated.
+in the &cv-link-FORTRANMODDIR; construction variables
+when the &cv-link-_FORTRANMODFLAG; variables is automatically generated.
</summary>
</cvar>
for specifying the directory location where the Fortran
compiler should place any module files that happen to get
generated during compilation.
-The value of &cv-_FORTRANMODFLAG; is created
-by prepending/appending &cv-FORTRANMODDIRPREFIX; and &cv-FORTRANMODDIRSUFFIX;
-to the beginning and end of the directory in &cv-FORTRANMODDIR;.
+The value of &cv-link-_FORTRANMODFLAG; is created
+by prepending/appending &cv-link-FORTRANMODDIRPREFIX; and
+&cv-link-FORTRANMODDIRSUFFIX;
+to the beginning and end of the directory in &cv-link-FORTRANMODDIR;.
</summary>
</cvar>
The directory list will be added to command lines
through the automatically-generated
-&cv-_FORTRANINCFLAGS;
+&cv-link-_FORTRANINCFLAGS;
construction variable,
which is constructed by
appending the values of the
-&cv-INCPREFIX; and &cv-INCSUFFIX;
+&cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
construction variables
to the beginning and end
-of each directory in &cv-FORTRANPATH;.
+of each directory in &cv-link-FORTRANPATH;.
Any command lines you define that need
the FORTRANPATH directory list should
-include &cv-_FORTRANINCFLAGS;:
+include &cv-link-_FORTRANINCFLAGS;:
<example>
env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURCE")
<summary>
The command line used to compile a Fortran source file to an object file
after first running the file through the C preprocessor.
-By default, any options specified in the &cv-FORTRANFLAGS;, &cv-CPPFLAGS;,
-_CPPDEFFLAGS, &cv-_FORTRANMODFLAG;, and &cv-_FORTRANINCFLAGS;
+By default, any options specified in the &cv-link-FORTRANFLAGS;,
+&cv-link-CPPFLAGS;,
+&cv-link-_CPPDEFFLAGS;,
+&cv-link-_FORTRANMODFLAG;, and
+&cv-link-_FORTRANINCFLAGS;
construction variables are included on this command line.
</summary>
</cvar>
<summary>
The string displayed when a Fortran source file
is compiled to a shared-library object file.
-If this is not set, then &cv-SHFORTRANCOM;
+If this is not set, then &cv-link-SHFORTRANCOM;
(the command line) is displayed.
</summary>
</cvar>
shared-library object file
after first running the file through the C preprocessor.
Any options specified
-in the &cv-SHFORTRANFLAGS; and &cv-CPPFLAGS; construction variables
+in the &cv-link-SHFORTRANFLAGS; and
+&cv-link-CPPFLAGS; construction variables
are included on this command line.
</summary>
</cvar>
The string displayed when
Ghostscript is used to convert
a PostScript file to a PDF file.
-If this is not set, then &cv-GSCOM; (the command line) is displayed.
+If this is not set, then &cv-link-GSCOM; (the command line) is displayed.
</summary>
</cvar>
else:
env['CC'] = 'icc'
env['CXX'] = 'icpc'
- env['LINK'] = '$CC'
+ # Don't reset LINK here;
+ # use smart_link which should already be here from link.py.
+ #env['LINK'] = '$CC'
env['AR'] = 'xiar'
env['LD'] = 'xild' # not used by default
<summary>
Builds a Java archive (<filename>.jar</filename>) file
from a source tree of <filename>.class</filename> files.
-If the &cv-JARCHDIR; value is set, the
+If the &cv-link-JARCHDIR; value is set, the
&jar;
command will change to the specified directory using the
<option>-C</option>
<summary>
The string displayed when the Java archive tool
is called
-If this is not set, then &cv-JARCOM; (the command line) is displayed.
+If this is not set, then &cv-link-JARCOM; (the command line) is displayed.
<example>
env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
The command line used to compile a directory tree containing
Java source files to
corresponding Java class files.
-Any options specified in the &cv-JAVACFLAGS; construction variable
+Any options specified in the &cv-link-JAVACFLAGS; construction variable
are included on this command line.
</summary>
</cvar>
The string displayed when compiling
a directory tree of Java source files to
corresponding Java class files.
-If this is not set, then &cv-JAVACCOM; (the command line) is displayed.
+If this is not set, then &cv-link-JAVACCOM; (the command line) is displayed.
<example>
env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
builder method.
If the construction variable
-&cv-JAVACLASSDIR;
+&cv-link-JAVACLASSDIR;
is set, either in the environment
or in the call to the
&b-JavaH;
<summary>
The command line used to generate C header and stub files
from Java classes.
-Any options specified in the &cv-JAVAHFLAGS; construction variable
+Any options specified in the &cv-link-JAVAHFLAGS; construction variable
are included on this command line.
</summary>
</cvar>
<summary>
The string displayed when C header and stub files
are generated from Java classes.
-If this is not set, then &cv-JAVAHCOM; (the command line) is displayed.
+If this is not set, then &cv-link-JAVAHCOM; (the command line) is displayed.
<example>
env = Environment(JAVAHCOMSTR = "Generating header/stub file(s) $TARGETS from $SOURCES")
<summary>
The string displayed when calling
the LaTeX structured formatter and typesetter.
-If this is not set, then &cv-LATEXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-LATEXCOM; (the command line) is displayed.
<example>
env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES")
The maximum number of times that LaTeX
will be re-run if the
<filename>.log</filename>
-generated by the &cv-LATEXCOM; command
+generated by the &cv-link-LATEXCOM; command
indicates that there are undefined references.
The default is to try to resolve undefined references
by re-running LaTeX up to three times.
<summary>
The string displayed when generating a source file
using the lexical analyzer generator.
-If this is not set, then &cv-LEXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-LEXCOM; (the command line) is displayed.
<example>
env = Environment(LEXCOMSTR = "Lex'ing $TARGET from $SOURCES")
<cvar name="LDMODULE">
<summary>
The linker for building loadable modules.
-By default, this is the same as &cv-SHLINK;.
+By default, this is the same as &cv-link-SHLINK;.
</summary>
</cvar>
<cvar name="LDMODULECOM">
<summary>
The command line for building loadable modules.
-On Mac OS X, this uses the &cv-LDMODULE;,
-&cv-LDMODULEFLAGS; and &cv-FRAMEWORKSFLAGS; variables.
-On other systems, this is the same as &cv-SHLINK;.
+On Mac OS X, this uses the &cv-link-LDMODULE;,
+&cv-link-LDMODULEFLAGS; and
+&cv-link-FRAMEWORKSFLAGS; variables.
+On other systems, this is the same as &cv-link-SHLINK;.
</summary>
</cvar>
<cvar name="LDMODULECOMSTR">
<summary>
The string displayed when building loadable modules.
-If this is not set, then &cv-LDMODULECOM; (the command line) is displayed.
+If this is not set, then &cv-link-LDMODULECOM; (the command line) is displayed.
</summary>
</cvar>
The prefix used for loadable module file names.
On Mac OS X, this is null;
on other systems, this is
-the same as &cv-SHLIBPREFIX;.
+the same as &cv-link-SHLIBPREFIX;.
</summary>
</cvar>
<summary>
The string displayed when object files
are linked into an executable.
-If this is not set, then &cv-LINKCOM; (the command line) is displayed.
+If this is not set, then &cv-link-LINKCOM; (the command line) is displayed.
<example>
env = Environment(LINKCOMSTR = "Linking $TARGET")
<emphasis>not</emphasis>
contain
<option>-l</option>
-(or similar) options for linking with the libraries listed in &cv-LIBS;,
+(or similar) options for linking with the libraries listed in &cv-link-LIBS;,
nor
<option>-L</option>
(or similar) library search path options
-that scons generates automatically from &cv-LIBPATH;.
+that scons generates automatically from &cv-link-LIBPATH;.
See
-&cv-_LIBFLAGS;
+&cv-link-_LIBFLAGS;
above,
for the variable that expands to library-link options,
and
-&cv-_LIBDIRFLAGS;
+&cv-link-_LIBDIRFLAGS;
above,
for the variable that expands to library search path options.
</summary>
<cvar name="SHLINKCOMSTR">
<summary>
The string displayed when programs using shared libraries are linked.
-If this is not set, then &cv-SHLINKCOM; (the command line) is displayed.
+If this is not set, then &cv-link-SHLINKCOM; (the command line) is displayed.
<example>
env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
<emphasis>not</emphasis>
contain
<option>-l</option>
-(or similar) options for linking with the libraries listed in &cv-LIBS;,
+(or similar) options for linking with the libraries listed in &cv-link-LIBS;,
nor
<option>-L</option>
(or similar) include search path options
-that scons generates automatically from &cv-LIBPATH;.
+that scons generates automatically from &cv-link-LIBPATH;.
See
-&cv-_LIBFLAGS;
+&cv-link-_LIBFLAGS;
above,
for the variable that expands to library-link options,
and
-&cv-_LIBDIRFLAGS;
+&cv-link-_LIBDIRFLAGS;
above,
for the variable that expands to library search path options.
</summary>
<builder name="M4">
<summary>
Builds an output file from an M4 input file.
-This uses a default &cv-M4FLAGS; value of
+This uses a default &cv-link-M4FLAGS; value of
<option>-E</option>,
which considers all warnings to be fatal
and stops on the first warning
<summary>
The string displayed when
a file is passed through the M4 macro preprocessor.
-If this is not set, then &cv-M4COM; (the command line) is displayed.
+If this is not set, then &cv-link-M4COM; (the command line) is displayed.
</summary>
</cvar>
link-time performance,
although parallel builds will no longer work.
You can generate PDB files with the <option>/Zi</option>
-switch by overriding the default &cv-CCPDBFLAGS; variable;
+switch by overriding the default &cv-link-CCPDBFLAGS; variable;
see the entry for that variable for specific examples.
</summary>
</cvar>
<cvar name="REGSVRCOMSTR">
<summary>
The string displayed when registering a newly-built DLL file.
-If this is not set, then &cv-REGSVRCOM; (the command line) is displayed.
+If this is not set, then &cv-link-REGSVRCOM; (the command line) is displayed.
</summary>
</cvar>
<cvar name="WIN32_INSERT_DEF">
<summary>
-A deprecated synonym for &cv-WINDOWS_INSERT_DEF;.
+A deprecated synonym for &cv-link-WINDOWS_INSERT_DEF;.
</summary>
</cvar>
<cvar name="WIN32DEFPREFIX">
<summary>
-A deprecated synonym for &cv-WINDOWSDEFPREFIX;.
+A deprecated synonym for &cv-link-WINDOWSDEFPREFIX;.
</summary>
</cvar>
<cvar name="WIN32DEFSUFFIX">
<summary>
-A deprecated synonym for &cv-WINDOWSDEFSUFFIX;.
+A deprecated synonym for &cv-link-WINDOWSDEFSUFFIX;.
</summary>
</cvar>
<cvar name="WIN32EXPPREFIX">
<summary>
-A deprecated synonym for &cv-WINDOWSEXPSUFFIX;.
+A deprecated synonym for &cv-link-WINDOWSEXPSUFFIX;.
</summary>
</cvar>
<cvar name="WIN32EXPSUFFIX">
<summary>
-A deprecated synonym for &cv-WINDOWSEXPSUFFIX;.
+A deprecated synonym for &cv-link-WINDOWSEXPSUFFIX;.
</summary>
</cvar>
if not SCons.Util.can_read_reg:
raise SCons.Errors.InternalError, "No Windows registry module was found"
- s = ''
+ # XXX This code assumes anything that isn't EXPRESS uses the default
+ # registry key string. Is this really true for all VS suites?
if suite == 'EXPRESS':
s = '\\VCExpress\\'
+ else:
+ s = '\\VisualStudio\\'
- # ToDo: add registry key strings for the other versions of visual
- # studio 2005.
settings_path = ""
try:
(settings_path, t) = SCons.Util.RegGetValue(SCons.Util.HKEY_CURRENT_USER,
to support building with precompiled headers.
The default value expands expands to the appropriate
Microsoft Visual C++ command-line options
-when the &cv-PCH; construction variable is set.
+when the &cv-link-PCH; construction variable is set.
</summary>
</cvar>
Microsoft Visual C++ PDB file.
The default value expands expands to appropriate
Microsoft Visual C++ command-line options
-when the &cv-PDB; construction variable is set.
+when the &cv-link-PDB; construction variable is set.
The Visual C++ compiler option that SCons uses by default
to generate PDB information is <option>/Z7</option>.
although parallel builds will no longer work.
You can generate PDB files with the <option>/Zi</option>
-switch by overriding the default &cv-CCPDBFLAGS; variable as follows:
+switch by overriding the default &cv-link-CCPDBFLAGS; variable as follows:
<example>
import SCons.Util
An alternative would be to use the <option>/Zi</option>
to put the debugging information in a separate <filename>.pdb</filename>
file for each object file by overriding
-the &cv-CCPDBFLAGS; variable as follows:
+the &cv-link-CCPDBFLAGS; variable as follows:
<example>
env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
<cvar name="PCHCOMSTR">
<summary>
The string displayed when generating a precompiled header.
-If this is not set, then &cv-PCHCOM; (the command line) is displayed.
+If this is not set, then &cv-link-PCHCOM; (the command line) is displayed.
</summary>
</cvar>
<summary>
The string displayed when invoking the resource compiler
to build a Microsoft Visual C++ resource file.
-If this is not set, then &cv-RCCOM; (the command line) is displayed.
+If this is not set, then &cv-link-RCCOM; (the command line) is displayed.
</summary>
</cvar>
# try and enumerate the installed versions of the .NET framework.
contents = os.listdir(rv['FRAMEWORKDIR'])
l = re.compile('v[0-9]+.*')
- versions = []
- for entry in contents:
- if l.match(entry):
- versions.append(entry)
+ installed_framework_versions = filter(lambda e, l=l: l.match(e), contents)
def versrt(a,b):
# since version numbers aren't really floats...
c = int(bbl[2]) - int(aal[2])
return c
- versions.sort(versrt)
+ installed_framework_versions.sort(versrt)
- rv['FRAMEWORKVERSIONS'] = versions
- # assume that the highest version is the latest version installed
- rv['FRAMEWORKVERSION'] = versions[0]
+ rv['FRAMEWORKVERSIONS'] = installed_framework_versions
- # .NET framework SDK install dir
- try:
- if rv.has_key('FRAMEWORKVERSION') and rv['FRAMEWORKVERSION'][:4] == 'v1.1':
- key = r'Software\Microsoft\.NETFramework\sdkInstallRootv1.1'
+ # TODO: allow a specific framework version to be set
+
+ # Choose a default framework version based on the Visual
+ # Studio version.
+ DefaultFrameworkVersionMap = {
+ '7.0' : 'v1.0',
+ '7.1' : 'v1.1',
+ '8.0' : 'v2.0',
+ # TODO: Does .NET 3.0 need to be worked into here somewhere?
+ }
+ try:
+ default_framework_version = DefaultFrameworkVersionMap[version[:3]]
+ except (KeyError, TypeError):
+ pass
else:
- key = r'Software\Microsoft\.NETFramework\sdkInstallRoot'
+ # Look for the first installed directory in FRAMEWORKDIR that
+ # begins with the framework version string that's appropriate
+ # for the Visual Studio version we're using.
+ for v in installed_framework_versions:
+ if v[:4] == default_framework_version:
+ rv['FRAMEWORKVERSION'] = v
+ break
- (rv['FRAMEWORKSDKDIR'], t) = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE,key)
+ # If the framework version couldn't be worked out by the previous
+ # code then fall back to using the latest version of the .NET
+ # framework
+ if not rv.has_key('FRAMEWORKVERSION'):
+ rv['FRAMEWORKVERSION'] = installed_framework_versions[0]
- except SCons.Util.RegError:
- pass
+ # .NET framework SDK install dir
+ if rv.has_key('FRAMEWORKVERSION'):
+ # The .NET SDK version used must match the .NET version used,
+ # so we deliberately don't fall back to other .NET framework SDK
+ # versions that might be present.
+ ver = rv['FRAMEWORKVERSION'][:4]
+ key = r'Software\Microsoft\.NETFramework\sdkInstallRoot' + ver
+ try:
+ (rv['FRAMEWORKSDKDIR'], t) = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE,
+ key)
+ except SCons.Util.RegError:
+ pass
# MS Platform SDK dir
try:
env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMain(env))
env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.abspath}" -f ${MSVSSCONSCRIPT.name}'
env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS'
- env['MSVSBUILDCOM'] = '$MSVSSCONSCOM $MSVSBUILDTARGET'
- env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM $MSVSBUILDTARGET'
- env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c $MSVSBUILDTARGET'
+ env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"'
+ env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"'
+ env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"'
env['MSVSENCODING'] = 'Windows-1252'
try:
if env.has_key('MSVS_VERSION'):
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 7.0:
- return env.Detect('devenv')
+ # The executable is 'devenv' in Visual Studio Pro,
+ # Team System and others. Express Editions have different
+ # executable names. Right now we're only going to worry
+ # about Visual C++ 2005 Express Edition.
+ return env.Detect('devenv') or env.Detect('vcexpress')
else:
return env.Detect('msdev')
else:
This builds a Visual Studio project file, based on the version of
Visual Studio that is configured (either the latest installed version,
or the version specified by
-&cv-MSVS_VERSION;
+&cv-link-MSVS_VERSION;
in the Environment constructor).
For Visual Studio 6, it will generate a
<filename>.dsp</filename>
file.
-For Visual Studio 7 (.NET), it will generate a
-<filename>.dsp</filename>
+For Visual Studio 7 (.NET) and later versions, it will generate a
+<filename>.vcproj</filename>
file.
By default,
and
<literal>misc</literal>.
These are pretty self-explanatory, but it should be noted that these
-lists are added to the &cv-SOURCES; construction variable as strings,
+lists are added to the &cv-link-SOURCES; construction variable as strings,
NOT as SCons File Nodes. This is because they represent file
names to be added to the project file, not the source files used to
build the project file.
The correct
suffix for the version of Visual Studio must be used,
but the
-&cv-MSVSPROJECTSUFFIX;
+&cv-link-MSVSPROJECTSUFFIX;
construction variable
will be defined to the correct value (see example below).
based on the version of Visual Studio that is configured
(either the latest installed version,
or the version specified by
-&cv-MSVS_VERSION;
+&cv-link-MSVS_VERSION;
in the construction environment).
For Visual Studio 6, it will generate a
<filename>.dsw</filename>
<literal>target</literal>:
The name of the target .dsw or .sln file. The correct
suffix for the version of Visual Studio must be used, but the value
-&cv-MSVSSOLUTIONSUFFIX;
+&cv-link-MSVSSOLUTIONSUFFIX;
will be defined to the correct value (see example below).
<literal>variant</literal>:
&b-MSVSProject;
Builder,
to be placed into the solution file.
-(NOTE: Currently only one project is supported per solution.)
It should be noted that these file names are NOT added to the $SOURCES
environment variable in form of files, but rather as strings. This
is because they represent file names to be added to the solution file,
not the source files used to build the solution file.
+(NOTE: Currently only one project is supported per solution.)
+
Example Usage:
<example>
The suffix used for Microsoft Visual Studio project (DSP) files.
The default value is
<filename>.vcproj</filename>
-when using Visual Studio version 7.x (.NET),
+when using Visual Studio version 7.x (.NET)
+or later version,
and
<filename>.dsp</filename>
when using earlier versions of Visual Studio.
that will be invoked by Visual Studio
project files
(through the
-&cv-MSVSSCONSCOM;
+&cv-link-MSVSSCONSCOM;
variable).
The default is the same sconscript file
that contains the call to
initialized from the external environment.
If set, this is used to construct a shorter and more
efficient search path in the
-&cv-MSVSSCONS;
+&cv-link-MSVSSCONS;
command line executed
from Microsoft Visual Studio project files.
</summary>
<filename>.ltx</filename>,
or
<filename>.latex</filename> input file).
-The suffix specified by the &cv-PDFSUFFIX; construction variable
+The suffix specified by the &cv-link-PDFSUFFIX; construction variable
(<filename>.pdf</filename> by default)
is added automatically to the target
if it is not already present. Example:
<summary>
Builds an output file from a moc input file. Moc input files are either
header files or cxx files. This builder is only available after using the
-tool 'qt'. See the &cv-QTDIR; variable for more information.
+tool 'qt'. See the &cv-link-QTDIR; variable for more information.
Example:
<example>
without using this builder. Using this builder lets you override the standard
naming conventions (be careful: prefixes are always prepended to names of
built files; if you don't want prefixes, you may set them to ``).
-See the &cv-QTDIR; variable for more information.
+See the &cv-link-QTDIR; variable for more information.
Example:
<example>
but are listed here with the '/' separator
for easier reading.)
In addition, the construction environment
-variables &cv-CPPPATH;, &cv-LIBPATH; and &cv-LIBS; may be modified
+variables &cv-link-CPPPATH;,
+&cv-link-LIBPATH; and
+&cv-link-LIBS; may be modified
and the variables
PROGEMITTER, SHLIBEMITTER and LIBEMITTER
are modified. Because the build-performance is affected when using this tool,
<cvar name="QT_BINPATH">
<summary>
The path where the qt binaries are installed.
-The default value is '&cv-QTDIR;/bin'.
+The default value is '&cv-link-QTDIR;/bin'.
</summary>
</cvar>
<cvar name="QT_CPPPATH">
<summary>
The path where the qt header files are installed.
-The default value is '&cv-QTDIR;/include'.
-Note: If you set this variable to None, the tool won't change the &cv-CPPPATH;
+The default value is '&cv-link-QTDIR;/include'.
+Note: If you set this variable to None,
+the tool won't change the &cv-link-CPPPATH;
construction variable.
</summary>
</cvar>
<cvar name="QT_LIB">
<summary>
Default value is 'qt'. You may want to set this to 'qt-mt'. Note: If you set
-this variable to None, the tool won't change the &cv-LIBS; variable.
+this variable to None, the tool won't change the &cv-link-LIBS; variable.
</summary>
</cvar>
<cvar name="QT_LIBPATH">
<summary>
The path where the qt libraries are installed.
-The default value is '&cv-QTDIR;/lib'.
-Note: If you set this variable to None, the tool won't change the &cv-LIBPATH;
+The default value is '&cv-link-QTDIR;/lib'.
+Note: If you set this variable to None,
+the tool won't change the &cv-link-LIBPATH;
construction variable.
</summary>
</cvar>
<cvar name="QT_MOC">
<summary>
-Default value is '&cv-QT_BINPATH;/moc'.
+Default value is '&cv-link-QT_BINPATH;/moc'.
</summary>
</cvar>
<cvar name="QT_MOCFROMCXXCOMSTR">
<summary>
The string displayed when generating a moc file from a cpp file.
-If this is not set, then &cv-QT_MOCFROMCXXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-QT_MOCFROMCXXCOM; (the command line) is displayed.
</summary>
</cvar>
<cvar name="QT_MOCFROMHCOMSTR">
<summary>
The string displayed when generating a moc file from a cpp file.
-If this is not set, then &cv-QT_MOCFROMHCOM; (the command line) is displayed.
+If this is not set, then &cv-link-QT_MOCFROMHCOM; (the command line) is displayed.
</summary>
</cvar>
<cvar name="QT_MOCHSUFFIX">
<summary>
-Default value is '&cv-CXXFILESUFFIX;'. Suffix for moc output files, when source is
+Default value is '&cv-link-CXXFILESUFFIX;'. Suffix for moc output files, when source is
a header.
</summary>
</cvar>
<cvar name="QT_UIC">
<summary>
-Default value is '&cv-QT_BINPATH;/uic'.
+Default value is '&cv-link-QT_BINPATH;/uic'.
</summary>
</cvar>
<cvar name="QT_UICCOMSTR">
<summary>
The string displayed when generating header files from .ui files.
-If this is not set, then &cv-QT_UICCOM; (the command line) is displayed.
+If this is not set, then &cv-link-QT_UICCOM; (the command line) is displayed.
</summary>
</cvar>
<cvar name="QT_UICIMPLSUFFIX">
<summary>
-Default value is '&cv-CXXFILESUFFIX;'. Suffix for uic generated implementation
+Default value is '&cv-link-CXXFILESUFFIX;'. Suffix for uic generated implementation
files.
</summary>
</cvar>
builder method.
If the construction variable
-&cv-JAVACLASSDIR;
+&cv-link-JAVACLASSDIR;
is set, either in the environment
or in the call to the
&b-RMIC;
The command line used to compile stub
and skeleton class files
from Java classes that contain RMI implementations.
-Any options specified in the &cv-RMICFLAGS; construction variable
+Any options specified in the &cv-link-RMICFLAGS; construction variable
are included on this command line.
</summary>
</cvar>
The string displayed when compiling
stub and skeleton class files
from Java classes that contain RMI implementations.
-If this is not set, then &cv-RMICCOM; (the command line) is displayed.
+If this is not set, then &cv-link-RMICCOM; (the command line) is displayed.
<example>
env = Environment(RMICCOMSTR = "Generating stub/skeleton class files $TARGETS from $SOURCES")
Options passed to the RPC protocol compiler
when generating client side stubs.
These are in addition to any flags specified in the
-&cv-RPCGENFLAGS;
+&cv-link-RPCGENFLAGS;
construction variable.
</summary>
</cvar>
Options passed to the RPC protocol compiler
when generating a header file.
These are in addition to any flags specified in the
-&cv-RPCGENFLAGS;
+&cv-link-RPCGENFLAGS;
construction variable.
</summary>
</cvar>
Options passed to the RPC protocol compiler
when generating server side stubs.
These are in addition to any flags specified in the
-&cv-RPCGENFLAGS;
+&cv-link-RPCGENFLAGS;
construction variable.
</summary>
</cvar>
Options passed to the RPC protocol compiler
when generating XDR routines.
These are in addition to any flags specified in the
-&cv-RPCGENFLAGS;
+&cv-link-RPCGENFLAGS;
construction variable.
</summary>
</cvar>
source files generated by
the scripting language wrapper and interface generator.
The default value is
-<filename>_wrap</filename>&cv-CFILESUFFIX;.
+<filename>_wrap</filename>&cv-link-CFILESUFFIX;.
By default, this value is used whenever the
<option>-c++</option>
option is
<emphasis>not</emphasis>
specified as part of the
-&cv-SWIGFLAGS;
+&cv-link-SWIGFLAGS;
construction variable.
</summary>
</cvar>
<summary>
The string displayed when calling
the scripting language wrapper and interface generator.
-If this is not set, then &cv-SWIGCOM; (the command line) is displayed.
+If this is not set, then &cv-link-SWIGCOM; (the command line) is displayed.
</summary>
</cvar>
source files generated by
the scripting language wrapper and interface generator.
The default value is
-<filename>_wrap</filename>&cv-CFILESUFFIX;.
+<filename>_wrap</filename>&cv-link-CFILESUFFIX;.
By default, this value is used whenever the
<filename>-c++</filename>
option is specified as part of the
-&cv-SWIGFLAGS;
+&cv-link-SWIGFLAGS;
construction variable.
</summary>
</cvar>
will, by default,
generate a C++ intermediate source file
with the extension that is specified as the
-&cv-CXXFILESUFFIX;
+&cv-link-CXXFILESUFFIX;
variable.
</summary>
</cvar>
<summary>
The string displayed when archiving files
using the tar archiver.
-If this is not set, then &cv-TARCOM; (the command line) is displayed.
+If this is not set, then &cv-link-TARCOM; (the command line) is displayed.
<example>
env = Environment(TARCOMSTR = "Archiving $TARGET")
openout_aux_re = re.compile(r"\\openout.*`(.*\.aux)'")
+makeindex_re = re.compile(r"^[^%]*\\makeindex", re.MULTILINE)
+tableofcontents_re = re.compile(r"^[^%]*\\tableofcontents", re.MULTILINE)
+bibliography_re = re.compile(r"^[^%]*\\bibliography", re.MULTILINE)
+
# An Action sufficient to build any generic tex file.
TeXAction = None
basename = SCons.Util.splitext(str(source[0]))[0]
basedir = os.path.split(str(source[0]))[0]
+ # Notice that all the filenames are not prefixed with the basedir.
+ # That's because the *COM variables have the cd command in the prolog.
+
+ bblfilename = basename + '.bbl'
+ bblContents = ""
+ if os.path.exists(bblfilename):
+ bblContents = open(bblfilename, "rb").read()
+
+ idxfilename = basename + '.idx'
+ idxContents = ""
+ if os.path.exists(idxfilename):
+ idxContents = open(idxfilename, "rb").read()
+
+ tocfilename = basename + '.toc'
+ tocContents = ""
+ if os.path.exists(tocfilename):
+ tocContents = open(tocfilename, "rb").read()
+
# Run LaTeX once to generate a new aux file.
XXXLaTeXAction(target, source, env)
BibTeXAction(bibfile, bibfile, env)
break
- # Now decide if makeindex will need to be run.
- idxfilename = basename + '.idx'
- if os.path.exists(idxfilename):
+ must_rerun_latex = 0
+ # Now decide if latex will need to be run again due to table of contents.
+ if os.path.exists(tocfilename) and tocContents != open(tocfilename, "rb").read():
+ must_rerun_latex = 1
+
+ # Now decide if latex will need to be run again due to bibliography.
+ if os.path.exists(bblfilename) and bblContents != open(bblfilename, "rb").read():
+ must_rerun_latex = 1
+
+ # Now decide if latex will need to be run again due to index.
+ if os.path.exists(idxfilename) and idxContents != open(idxfilename, "rb").read():
+ # We must run makeindex
idxfile = env.fs.File(basename)
- # TODO: if ( idxfile has changed) ...
MakeIndexAction(idxfile, idxfile, env)
- XXXLaTeXAction(target, source, env)
+ must_rerun_latex = 1
- # Now decide if latex will need to be run again due to table of contents.
- tocfilename = basename + '.toc'
- if os.path.exists(tocfilename):
- # TODO: if ( tocfilename has changed) ...
+ if must_rerun_latex == 1:
XXXLaTeXAction(target, source, env)
- # Now decide if latex needs to be run yet again.
+ # Now decide if latex needs to be run yet again to resolve warnings.
logfilename = basename + '.log'
for _ in range(int(env.subst('$LATEXRETRIES'))):
if not os.path.exists(logfilename):
target.append(base + '.log')
for f in source:
content = f.get_contents()
- if string.find(content, r'\tableofcontents') != -1:
+ if tableofcontents_re.search(content):
target.append(base + '.toc')
- if string.find(content, r'\makeindex') != -1:
+ env.Precious(base + '.toc')
+ if makeindex_re.search(content):
target.append(base + '.ilg')
target.append(base + '.ind')
target.append(base + '.idx')
- if string.find(content, r'\bibliography') != -1:
+ env.Precious(base + '.idx')
+ if bibliography_re.search(content):
target.append(base + '.bbl')
+ env.Precious(base + '.bbl')
target.append(base + '.blg')
# read log file to get all .aux files
logfilename = base + '.log'
+ dir, base_nodir = os.path.split(base)
if os.path.exists(logfilename):
content = open(logfilename, "rb").read()
aux_files = openout_aux_re.findall(content)
- aux_files = filter(lambda f, b=base+'.aux': f != b, aux_files)
- dir = os.path.split(base)[0]
+ aux_files = filter(lambda f, b=base_nodir+'.aux': f != b, aux_files)
aux_files = map(lambda f, d=dir: d+os.sep+f, aux_files)
target.extend(aux_files)
+ for a in aux_files:
+ env.Precious( a )
return (target, source)
<summary>
The string displayed when generating a bibliography
for TeX or LaTeX.
-If this is not set, then &cv-BIBTEXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-BIBTEXCOM; (the command line) is displayed.
<example>
env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET")
The string displayed when calling the makeindex generator for the
TeX formatter and typesetter
and the LaTeX structured formatter and typesetter.
-If this is not set, then &cv-MAKEINDEXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-MAKEINDEXCOM; (the command line) is displayed.
</summary>
</cvar>
<summary>
The string displayed when calling
the TeX formatter and typesetter.
-If this is not set, then &cv-TEXCOM; (the command line) is displayed.
+If this is not set, then &cv-link-TEXCOM; (the command line) is displayed.
<example>
env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
<summary>
The string displayed when generating a source file
using the parser generator.
-If this is not set, then &cv-YACCCOM; (the command line) is displayed.
+If this is not set, then &cv-link-YACCCOM; (the command line) is displayed.
<example>
env = Environment(YACCCOMSTR = "Yacc'ing $TARGET from $SOURCES")
<cvar name="YACCFLAGS">
<summary>
General options passed to the parser generator.
-If &cv-YACCFLAGS; contains a <option>-d</option> option,
+If &cv-link-YACCFLAGS; contains a <option>-d</option> option,
SCons assumes that the call will also create a .h file
(if the yacc source file ends in a .y suffix)
or a .hpp file
<summary>
The string displayed when archiving files
using the zip utility.
-If this is not set, then &cv-ZIPCOM;
+If this is not set, then &cv-link-ZIPCOM;
(the command line or internal Python function) is displayed.
<example>
return t is ListType \
or (t is InstanceType and isinstance(obj, UserList))
+def is_Sequence(obj):
+ t = type(obj)
+ return t is ListType \
+ or t is TupleType \
+ or (t is InstanceType and isinstance(obj, UserList))
+
def is_Tuple(obj):
t = type(obj)
return t is TupleType
official versions is still a desirable goal, we just don't need to be
obsessive about it.)
-We name the compatibility modules with an initial underscore (for
-example, _subprocess.py is our compatibility module for subprocess)
-so that we can still try to import the real module name and fall back
-to our compatibility module if we get an ImportError. The import_as()
+We name the compatibility modules with an initial '_scons_' (for example,
+_scons_subprocess.py is our compatibility module for subprocess) so
+that we can still try to import the real module name and fall back to
+our compatibility module if we get an ImportError. The import_as()
function defined below loads the module as the "real" name (without the
underscore), after which all of the "import {module}" statements in the
rest of our code will find our pre-loaded compatibility module.
try:
# Python 2.2 and 2.3 can use the copy of the 2.[45] sets module
# that we grabbed.
- import_as('_sets', 'sets')
+ import_as('_scons_sets', 'sets')
except (ImportError, SyntaxError):
# Python 1.5 (ImportError, no __future_ module) and 2.1
# (SyntaxError, no generators in __future__) will blow up
# trying to import the 2.[45] sets module, so back off to a
# custom sets module that can be discarded easily when we
# stop supporting those versions.
- import_as('_sets15', 'sets')
+ import_as('_scons_sets15', 'sets')
import __builtin__
import sets
__builtin__.set = sets.Set
import subprocess
except ImportError:
# Pre-2.4 Python has no subprocess module.
- import_as('_subprocess', 'subprocess')
+ import_as('_scons_subprocess', 'subprocess')
try:
import UserString
except ImportError:
# Pre-1.6 Python has no UserString module.
- import_as('_UserString', 'UserString')
+ import_as('_scons_UserString', 'UserString')
# Close pipe fds. Make sure we don't close the same
# fd more than once, or standard fds.
- for fd in set((p2cread, c2pwrite, errwrite))-set((0,1,2)):
- if fd: os.close(fd)
+ try:
+ set
+ except NameError:
+ # Fall-back for earlier Python versions, so epydoc
+ # can use this module directly to execute things.
+ if p2cread:
+ os.close(p2cread)
+ if c2pwrite and c2pwrite not in (p2cread,):
+ os.close(c2pwrite)
+ if errwrite and errwrite not in (p2cread, c2pwrite):
+ os.close(errwrite)
+ else:
+ for fd in set((p2cread, c2pwrite, errwrite))-set((0,1,2)):
+ if fd: os.close(fd)
# Close all other fds, if asked for
if close_fds:
@REM no way to set exit status of this script for 9x/Me\r
goto endscons\r
:WinNT\r
-set path=%path%;%~dp0\r
+@REM set path=%path%;%~dp0\r
python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-__VERSION__'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %*\r
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endscons\r
if errorlevel 9009 echo you do not have python in your PATH\r
[bdist_wininst]
title = SCons - a software construction tool
-install-script = scons-post-install.py
+#install-script = scons-post-install.py
import string
import sys
-Version = "0.96.94"
-
-man_pages = [
- 'scons.1',
- 'sconsign.1',
- 'scons-time.1',
-]
+Version = "0.96.96"
man_pages = [
'scons.1',
'script/scons.bat',
]
-if is_win32:
- scripts = scripts + [
- 'script/scons-post-install.py'
- ]
+#if is_win32:
+# scripts = scripts + [
+# 'script/scons-post-install.py'
+# ]
arguments = {
'name' : "scons",
build_src = build_path('scons-src')
class Checker:
- def __init__(self, directory, search_list = [], remove_list=[]):
+ def __init__(self, directory,
+ search_list = [],
+ remove_list = [],
+ remove_patterns = []):
self.directory = directory
self.search_list = search_list
self.remove_dict = {}
for r in remove_list:
self.remove_dict[os.path.join(directory, r)] = 1
+ self.remove_patterns = remove_patterns
def directory_exists(self):
return os.path.exists(self.directory)
- def remove_path(self, path):
- return self.remove_dict.get(path)
+ def remove_this(self, name, path):
+ if self.remove_dict.get(path):
+ return 1
+ else:
+ for pattern in self.remove_patterns:
+ if fnmatch.fnmatch(name, pattern):
+ return 1
+ return 0
def search_this(self, path):
if self.search_list:
def visit(self, result, dirname, names):
make_path_tuple = lambda n, d=dirname: (n, os.path.join(d, n))
for name, path in map(make_path_tuple, names):
- if self.remove_path(path):
+ if self.remove_this(name, path):
names.remove(name)
elif self.search_this(path):
body = open(path, 'r').read()
'src',
search_list = [ '*.py' ],
remove_list = [
- 'engine/SCons/compat/_sets.py',
- 'engine/SCons/compat/_sets15.py',
- 'engine/SCons/compat/_subprocess.py',
+ 'engine/SCons/compat/_scons_sets.py',
+ 'engine/SCons/compat/_scons_sets15.py',
+ 'engine/SCons/compat/_scons_subprocess.py',
'engine/SCons/Conftest.py',
'engine/SCons/dblite.py',
'engine/SCons/Optik',
'debian',
'dist',
'gentoo',
- 'engine/SCons/compat/_sets.py',
- 'engine/SCons/compat/_sets15.py',
- 'engine/SCons/compat/_subprocess.py',
+ 'engine/SCons/compat/_scons_sets.py',
+ 'engine/SCons/compat/_scons_sets15.py',
+ 'engine/SCons/compat/_scons_subprocess.py',
'engine/SCons/Conftest.py',
'engine/SCons/dblite.py',
'engine/SCons/Optik',
'os_spawnv_fix.diff',
'setup.cfg',
],
+ # We run epydoc on the *.py files, which generates *.pyc files.
+ remove_patterns = [
+ '*.pyc'
+ ]
),
CheckExpandedCopyright(
build_local,
remove_list = [
- 'SCons/compat/_sets.py',
- 'SCons/compat/_sets15.py',
- 'SCons/compat/_subprocess.py',
+ 'SCons/compat/_scons_sets.py',
+ 'SCons/compat/_scons_sets15.py',
+ 'SCons/compat/_scons_subprocess.py',
'SCons/Conftest.py',
'SCons/dblite.py',
'SCons/Optik',
'src/engine/MANIFEST.in',
'src/engine/MANIFEST-xml.in',
'src/engine/setup.cfg',
- 'src/engine/SCons/compat/_sets.py',
- 'src/engine/SCons/compat/_sets15.py',
- 'src/engine/SCons/compat/_subprocess.py',
+ 'src/engine/SCons/compat/_scons_sets.py',
+ 'src/engine/SCons/compat/_scons_sets15.py',
+ 'src/engine/SCons/compat/_scons_subprocess.py',
'src/engine/SCons/Conftest.py',
'src/engine/SCons/dblite.py',
'src/engine/SCons/Optik',
test_list = [
'xyz',
['x', 'y', 'z'],
- ['x', ['y', 123], 'z'],
+ ['x', ['y', 123], 'z', ('int', '$INTEGER')],
{ 'c' : 3, 'b': None, 'a' : 1 },
]
-env = Environment(CPPDEFPREFIX='-D', CPPDEFSUFFIX='')
+env = Environment(CPPDEFPREFIX='-D', CPPDEFSUFFIX='', INTEGER=0)
for i in test_list:
print env.Clone(CPPDEFINES=i).subst('$_CPPDEFFLAGS')
-env = Environment(CPPDEFPREFIX='|', CPPDEFSUFFIX='|')
+env = Environment(CPPDEFPREFIX='|', CPPDEFSUFFIX='|', INTEGER=1)
for i in test_list:
print env.Clone(CPPDEFINES=i).subst('$_CPPDEFFLAGS')
""")
read_str = """\
-Dxyz
-Dx -Dy -Dz
--Dx -Dy=123 -Dz
+-Dx -Dy=123 -Dz -Dint=0
-Da=1 -Db -Dc=3
|xyz|
|x| |y| |z|
-|x| |y=123| |z|
+|x| |y=123| |z| |int=1|
|a=1| |b| |c=3|
""")
test.run(arguments = '.', stdout=expect)
test.write('SConstruct', """\
-foo = Environment(CPPDEFINES = ['FOO', ('VAL', 7)])
+foo = Environment(CPPDEFINES = ['FOO', ('VAL', '$VALUE')], VALUE=7)
bar = Environment(CPPDEFINES = {'BAR':None, 'VAL':8})
baz = Environment(CPPDEFINES = ['BAZ', ('VAL', 9)])
f = foo.Object(target = 'foo', source = 'prog.c')
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os
-import sys
+import os.path
+
import TestSCons
_exe = TestSCons._exe
# Make sure we didn't duplicate the source file in the variant subdirectory.
-test.fail_test(os.path.exists(test.workpath('variant', 'prog.c')))
+test.must_not_exist(test.workpath('variant', 'prog.c'))
test.up_to_date(arguments = args)
# Make sure we didn't duplicate the source file in the variant subdirectory.
-test.fail_test(os.path.exists(test.workpath('variant', 'prog.c')))
+test.must_not_exist(test.workpath('variant', 'prog.c'))
test.up_to_date(arguments = args)
""")
# Make sure we didn't duplicate the source file in the variant subdirectory.
-test.fail_test(os.path.exists(test.workpath('variant', 'prog.c')))
+test.must_not_exist(test.workpath('variant', 'prog.c'))
test.up_to_date(arguments = args)
-# Check that neither a null-string CPPPATH nor a
-# a CPPPATH containing null values blows up.
-test.write('SConstruct', """
-env = Environment(CPPPATH = '')
-env.Library('one', source = 'empty1.c')
-env = Environment(CPPPATH = [None])
-env.Library('two', source = 'empty2.c')
-env = Environment(CPPPATH = [''])
-env.Library('three', source = 'empty3.c')
-""")
-
-test.write('empty1.c', "int a=0;\n")
-test.write('empty2.c', "int b=0;\n")
-test.write('empty3.c', "int c=0;\n")
-
-test.run(arguments = '.',
- stderr=TestSCons.noisy_ar,
- match=TestSCons.match_re_dotall)
-
-
-
test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that CPPPATH values with Dir nodes work correctly.
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+
+test = TestSCons.TestSCons()
+
+test.subdir('inc1', 'inc2', 'inc3', ['inc3', 'subdir'])
+
+test.write('SConstruct', """
+env = Environment(CPPPATH = [Dir('inc1'), '$INC2', '$INC3/subdir'],
+ INC2 = Dir('inc2'),
+ INC3 = Dir('inc3'))
+env.Program('prog.c')
+""")
+
+test.write('prog.c', """\
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "one.h"
+#include "two.h"
+#include "three.h"
+int
+main(int argc, char *argv[])
+{
+ printf("%s\\n", ONE);
+ printf("%s\\n", TWO);
+ printf("%s\\n", THREE);
+ return (0);
+}
+""")
+
+test.write(['inc1', 'one.h'], """\
+#define ONE "1"
+""")
+
+test.write(['inc2', 'two.h'], """\
+#define TWO "2"
+""")
+
+test.write(['inc3', 'subdir', 'three.h'], """\
+#define THREE "3"
+""")
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('prog' + _exe), stdout = "1\n2\n3\n")
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Make sure that $CPPPATH expands correctly if one of the subsidiary
+expansions contains a stringable non-Node object.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+class XXX:
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return 'XXX-' + self.value + '-XXX'
+env = Environment(CPPPATH = ['#',
+ '$BUILDDIR',
+ '/tmp/xyzzy'],
+ BUILDDIR = '#scons_build/$EXPANSION',
+ EXPANSION = XXX('win32'))
+env.Object('foo.c')
+""")
+
+test.write('foo.c', """\
+#include <stdio.h>
+void
+foo(void)
+{
+ printf("foo.c\\n");
+}
+""")
+
+test.run(arguments = '.')
+
+test.must_exist(test.workpath('foo' + TestSCons._obj))
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that CPPPATH values consisting of nested lists work correctly.
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+
+test = TestSCons.TestSCons()
+
+test.subdir('inc1', 'inc2', 'inc3')
+
+test.write('SConstruct', """
+env = Environment(CPPPATH = ['inc1', ['inc2', ['inc3']]])
+env.Program('prog.c')
+""")
+
+test.write('prog.c', """\
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "one.h"
+#include "two.h"
+#include "three.h"
+int
+main(int argc, char *argv[])
+{
+ printf("%s\\n", ONE);
+ printf("%s\\n", TWO);
+ printf("%s\\n", THREE);
+ return (0);
+}
+""")
+
+test.write(['inc1', 'one.h'], """\
+#define ONE "1"
+""")
+
+test.write(['inc2', 'two.h'], """\
+#define TWO "2"
+""")
+
+test.write(['inc3', 'three.h'], """\
+#define THREE "3"
+""")
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('prog' + _exe), stdout = "1\n2\n3\n")
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that neither a null-string CPPPATH nor a
+a CPPPATH containing null values blows up.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(CPPPATH = '')
+env.Library('one', source = 'empty1.c')
+env = Environment(CPPPATH = [None])
+env.Library('two', source = 'empty2.c')
+env = Environment(CPPPATH = [''])
+env.Library('three', source = 'empty3.c')
+""")
+
+test.write('empty1.c', "int a=0;\n")
+test.write('empty2.c', "int b=0;\n")
+test.write('empty3.c', "int c=0;\n")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+
+
+test.pass_test()
test = TestSCons.TestSCons()
test.write('SConstruct', """
-env = Environment(tools = ['g++'])
+env = Environment(tools = ['g++'], CXX = 'g++')
env.Object(target = 'test.obj', source = 'test.cxx')
env.MergeFlags('+for_CCFLAGS -Wp,-for_CPPFLAGS')
""")
sconstruct = """
import os
-CacheDir('%s')
+CacheDir(r'%s')
Program('foo', 'foo.c')
""" % test.workpath('cache')
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that we print a useful message (and exit non-zero) if an external
+error occurs while deciding if a Node is current or not.
+"""
+
+import sys
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+install = test.workpath('install')
+install_file = test.workpath('install', 'file')
+work_file = test.workpath('work', 'file')
+
+test.subdir('install', 'work')
+
+test.write(['work', 'SConstruct'], """\
+Alias("install", Install(r"%(install)s", File('file')))
+
+# Make a directory where we expect the File() to be. This causes an
+# IOError or OSError when we try to open it to read its signature.
+import os
+os.mkdir(r'%(work_file)s')
+""" % locals())
+
+if sys.platform == 'win32':
+ error_message = "Permission denied"
+else:
+ error_message = "Is a directory"
+
+expect = """\
+scons: *** [%(install_file)s] %(work_file)s: %(error_message)s
+""" % locals()
+
+test.run(chdir = 'work',
+ arguments = 'install',
+ status = 2,
+ stderr = expect)
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Simple "Hello, world" test of linking with the Intel C++ compiler, icpc.
+
+This tests for a bug (1415) where our initialization of the linker to
+$CC prevented automatic linking of C++ source.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+icpc = test.detect_tool('intelc', prog='icpc')
+if not icpc:
+ test.skip_test("Could not find 'icpc' from 'intelc' Tool; skipping test(s).\n")
+
+test.write('SConstruct', """\
+env = Environment(tools=['default', 'intelc'])
+env.Program('hw', 'hw.cpp')
+""")
+
+test.write('hw.cpp', """\
+#include <iostream>
+int
+main()
+{
+ std::cout<<"hw\\n";
+ return 0;
+}
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""
+Test setting the JAVAC variable.
+"""
+
import os
import os.path
import string
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-
-
-test.write("wrapper.py", """\
-import os
-import string
-import sys
-open('%s', 'ab').write("wrapper.py %%s\\n" %% string.join(sys.argv[1:]))
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
-
-test.write('SConstruct', """
-foo = Environment(tools = ['javac'],
- JAVAC = r'%(where_javac)s')
-javac = foo.Dictionary('JAVAC')
-bar = foo.Clone(JAVAC = r'%(_python_)s wrapper.py ' + javac)
-foo.Java(target = 'class1', source = 'com/sub/foo')
-bar.Java(target = 'class2', source = 'com/sub/bar')
-foo.Java(target = 'class3', source = ['src1', 'src2'])
-""" % locals())
-
-test.subdir('com',
- ['com', 'sub'],
- ['com', 'sub', 'foo'],
- ['com', 'sub', 'bar'],
- 'src1',
- 'src2')
-
-test.write(['com', 'sub', 'foo', 'Example1.java'], """\
-package com.sub.foo;
-
-public class Example1
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-test.write(['com', 'sub', 'foo', 'Example2.java'], """\
-package com.other;
-
-public class Example2
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-test.write(['com', 'sub', 'foo', 'Example3.java'], """\
-package com.sub.foo;
-
-public class Example3
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-test.write(['com', 'sub', 'bar', 'Example4.java'], """\
-package com.sub.bar;
-
-public class Example4
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-test.write(['com', 'sub', 'bar', 'Example5.java'], """\
-package com.other;
-
-public class Example5
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-test.write(['com', 'sub', 'bar', 'Example6.java'], """\
-package com.sub.bar;
-
-public class Example6
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-test.write(['src1', 'Example7.java'], """\
-public class Example7
-{
-
- public static void main(String[] args)
- {
-
- }
-
-}
-""")
-
-# Acid-test file for parsing inner Java classes, courtesy Chad Austin.
-test.write(['src2', 'Test.java'], """\
-class Empty {
-}
-
-interface Listener {
- public void execute();
-}
-
-public
-class
-Test {
- class Inner {
- void go() {
- use(new Listener() {
- public void execute() {
- System.out.println("In Inner");
- }
- });
- }
- String s1 = "class A";
- String s2 = "new Listener() { }";
- /* class B */
- /* new Listener() { } */
- }
-
- public static void main(String[] args) {
- new Test().run();
- }
-
- void run() {
- use(new Listener() {
- public void execute() {
- use(new Listener( ) {
- public void execute() {
- System.out.println("Inside execute()");
- }
- });
- }
- });
-
- new Inner().go();
- }
-
- void use(Listener l) {
- l.execute();
- }
-}
-
-class Private {
- void run() {
- new Listener() {
- public void execute() {
- }
- };
- }
-}
-""")
-
-test.run(arguments = '.')
-
-expected_wrapper_out = "wrapper.py %s -d class2 -sourcepath com/sub/bar com/sub/bar/Example4.java com/sub/bar/Example5.java com/sub/bar/Example6.java\n"
-expected_wrapper_out = string.replace(expected_wrapper_out, '/', os.sep)
-test.must_match('wrapper.out', expected_wrapper_out % where_javac)
-
-test.must_exist(test.workpath('class1', 'com', 'sub', 'foo', 'Example1.class'))
-test.must_exist(test.workpath('class1', 'com', 'other', 'Example2.class'))
-test.must_exist(test.workpath('class1', 'com', 'sub', 'foo', 'Example3.class'))
-
-test.must_exist(test.workpath('class2', 'com', 'sub', 'bar', 'Example4.class'))
-test.must_exist(test.workpath('class2', 'com', 'other', 'Example5.class'))
-test.must_exist(test.workpath('class2', 'com', 'sub', 'bar', 'Example6.class'))
-
-test.must_exist(test.workpath('class3', 'Example7.class'))
-
-test.must_exist(test.workpath('class3', 'Empty.class'))
-test.must_exist(test.workpath('class3', 'Listener.class'))
-test.must_exist(test.workpath('class3', 'Private.class'))
-test.must_exist(test.workpath('class3', 'Private$1.class'))
-test.must_exist(test.workpath('class3', 'Test.class'))
-test.must_exist(test.workpath('class3', 'Test$1.class'))
-test.must_exist(test.workpath('class3', 'Test$2.class'))
-test.must_exist(test.workpath('class3', 'Test$3.class'))
-test.must_exist(test.workpath('class3', 'Test$Inner.class'))
-
-test.up_to_date(arguments = '.')
-
test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test Java compilation with a live "javac" compiler.
+"""
+
+import os
+import os.path
+import string
+import sys
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+ENV = test.java_ENV()
+
+if test.detect_tool('javac', ENV=ENV):
+ where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
+else:
+ where_javac = test.where_is('javac')
+if not where_javac:
+ test.skip_test("Could not find Java javac, skipping test(s).\n")
+
+
+
+test.write('SConstruct', """
+env = Environment(tools = ['javac'],
+ JAVAC = r'%(where_javac)s')
+env.Java(target = 'class1', source = 'com/sub/foo')
+env.Java(target = 'class2', source = 'com/sub/bar')
+env.Java(target = 'class3', source = ['src1', 'src2'])
+env.Java(target = 'class4', source = ['src4'])
+env.Java(target = 'class5', source = ['src5'])
+""" % locals())
+
+test.subdir('com',
+ ['com', 'sub'],
+ ['com', 'sub', 'foo'],
+ ['com', 'sub', 'bar'],
+ 'src1',
+ 'src2',
+ 'src4',
+ 'src5')
+
+test.write(['com', 'sub', 'foo', 'Example1.java'], """\
+package com.sub.foo;
+
+public class Example1
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+test.write(['com', 'sub', 'foo', 'Example2.java'], """\
+package com.other;
+
+public class Example2
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+test.write(['com', 'sub', 'foo', 'Example3.java'], """\
+package com.sub.foo;
+
+public class Example3
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+test.write(['com', 'sub', 'bar', 'Example4.java'], """\
+package com.sub.bar;
+
+public class Example4
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+test.write(['com', 'sub', 'bar', 'Example5.java'], """\
+package com.other;
+
+public class Example5
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+test.write(['com', 'sub', 'bar', 'Example6.java'], """\
+package com.sub.bar;
+
+public class Example6
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+test.write(['src1', 'Example7.java'], """\
+public class Example7
+{
+
+ public static void main(String[] args)
+ {
+
+ }
+
+}
+""")
+
+# Acid-test file for parsing inner Java classes, courtesy Chad Austin.
+test.write(['src2', 'Test.java'], """\
+class Empty {
+}
+
+interface Listener {
+ public void execute();
+}
+
+public
+class
+Test {
+ class Inner {
+ void go() {
+ use(new Listener() {
+ public void execute() {
+ System.out.println("In Inner");
+ }
+ });
+ }
+ String s1 = "class A";
+ String s2 = "new Listener() { }";
+ /* class B */
+ /* new Listener() { } */
+ }
+
+ public static void main(String[] args) {
+ new Test().run();
+ }
+
+ void run() {
+ use(new Listener() {
+ public void execute() {
+ use(new Listener( ) {
+ public void execute() {
+ System.out.println("Inside execute()");
+ }
+ });
+ }
+ });
+
+ new Inner().go();
+ }
+
+ void use(Listener l) {
+ l.execute();
+ }
+}
+
+class Private {
+ void run() {
+ new Listener() {
+ public void execute() {
+ }
+ };
+ }
+}
+""")
+
+# Testing nested anonymous inner classes, courtesy Brandon Mansfield.
+test.write(['src4', 'NestedExample.java'], """\
+// import java.util.*;
+
+public class NestedExample
+{
+ public NestedExample()
+ {
+ Thread t = new Thread() {
+ public void start()
+ {
+ Thread t = new Thread() {
+ public void start()
+ {
+ try {Thread.sleep(200);}
+ catch (Exception e) {}
+ }
+ };
+ while (true)
+ {
+ try {Thread.sleep(200);}
+ catch (Exception e) {}
+ }
+ }
+ };
+ }
+
+
+ public static void main(String argv[])
+ {
+ NestedExample e = new NestedExample();
+ }
+}
+""")
+
+# Test not finding an anonymous class when the second token after a
+# "new" is a closing brace. This duplicates a test from the unit tests,
+# but lets us make sure that we correctly determine that everything is
+# up-to-date after the build.
+test.write(['src5', 'TestSCons.java'], """\
+class TestSCons {
+ public static void main(String[] args) {
+ Foo[] fooArray = new Foo[] { new Foo() };
+ }
+}
+
+class Foo { }
+""")
+
+test.run(arguments = '.')
+
+def get_class_files(dir):
+ def find_class_files(arg, dirname, fnames):
+ for fname in fnames:
+ if fname[-6:] == '.class':
+ arg.append(os.path.join(dirname, fname))
+ result = []
+ os.path.walk(dir, find_class_files, result)
+ result.sort()
+ return result
+
+classes_1 = get_class_files(test.workpath('class1'))
+classes_2 = get_class_files(test.workpath('class2'))
+classes_3 = get_class_files(test.workpath('class3'))
+classes_4 = get_class_files(test.workpath('class4'))
+classes_5 = get_class_files(test.workpath('class5'))
+
+expect_1 = [
+ test.workpath('class1', 'com', 'other', 'Example2.class'),
+ test.workpath('class1', 'com', 'sub', 'foo', 'Example1.class'),
+ test.workpath('class1', 'com', 'sub', 'foo', 'Example3.class'),
+]
+
+expect_2 = [
+ test.workpath('class2', 'com', 'other', 'Example5.class'),
+ test.workpath('class2', 'com', 'sub', 'bar', 'Example4.class'),
+ test.workpath('class2', 'com', 'sub', 'bar', 'Example6.class'),
+]
+
+expect_3 = [
+ test.workpath('class3', 'Empty.class'),
+ test.workpath('class3', 'Example7.class'),
+ test.workpath('class3', 'Listener.class'),
+ test.workpath('class3', 'Private$1.class'),
+ test.workpath('class3', 'Private.class'),
+ test.workpath('class3', 'Test$1.class'),
+ test.workpath('class3', 'Test$2.class'),
+ test.workpath('class3', 'Test$3.class'),
+ test.workpath('class3', 'Test$Inner.class'),
+ test.workpath('class3', 'Test.class'),
+]
+
+expect_4 = [
+ test.workpath('class4', 'NestedExample$1.class'),
+ test.workpath('class4', 'NestedExample$2.class'),
+ test.workpath('class4', 'NestedExample.class'),
+]
+
+expect_5 = [
+ test.workpath('class5', 'Foo.class'),
+ test.workpath('class5', 'TestSCons.class'),
+]
+
+def classes_must_match(dir, expect, got):
+ if expect != got:
+ sys.stderr.write("Expected the following class files in '%s':\n" % dir)
+ for c in expect:
+ sys.stderr.write(' %s\n' % c)
+ sys.stderr.write("Got the following class files in '%s':\n" % dir)
+ for c in got:
+ sys.stderr.write(' %s\n' % c)
+ test.fail_test()
+
+classes_must_match('class1', expect_1, classes_1)
+classes_must_match('class2', expect_2, classes_2)
+classes_must_match('class3', expect_3, classes_3)
+classes_must_match('class4', expect_4, classes_4)
+
+test.up_to_date(arguments = '.')
+
+test.pass_test()
\t\t\t>
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c Test.exe"
+\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c "Test.exe""
\t\t\t\tOutput="Test.exe"
\t\t\t\tPreprocessorDefinitions=""
\t\t\t\tIncludeSearchPath=""
\t\t\t>
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c Test.exe"
+\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c "Test.exe""
\t\t\t\tOutput="runfile.exe"
\t\t\t\tPreprocessorDefinitions=""
\t\t\t\tIncludeSearchPath=""
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir ""
-# PROP BASE Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct Test.exe"
-# PROP BASE Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct Test.exe"
+# PROP BASE Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+# PROP BASE Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct "Test.exe""
# PROP BASE Target_File "Test.exe"
# PROP BASE Bsc_Name ""
# PROP BASE Target_Dir ""
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir ""
-# PROP Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct Test.exe"
-# PROP Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct Test.exe"
+# PROP Cmd_Line "echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+# PROP Rebuild_Opt "-c && echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN>" -C "<WORKPATH>" -f SConstruct "Test.exe""
# PROP Target_File "Test.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
\t\t\tATLMinimizesCRunTimeLibraryUsage="FALSE">
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c Test.exe"
-\t\t\t\tRebuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
+\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c "Test.exe""
+\t\t\t\tRebuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
\t\t\t\tOutput="Test.exe"/>
\t\t</Configuration>
\t</Configurations>
\t\t\tATLMinimizesCRunTimeLibraryUsage="FALSE">
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c Test.exe"
-\t\t\t\tRebuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
+\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c "Test.exe""
+\t\t\t\tRebuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
\t\t\t\tOutput="Test.exe"/>
\t\t</Configuration>
\t</Configurations>
\t\t\t>
\t\t\t<Tool
\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct Test.exe"
-\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c Test.exe"
+\t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
+\t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c "Test.exe""
\t\t\t\tOutput="Test.exe"
\t\t\t\tPreprocessorDefinitions=""
\t\t\t\tIncludeSearchPath=""
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that parallel builds work correctly when a Node is duplicated
+in the children (once in the sources and once in the depends list).
+"""
+
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+test.write('cat.py', """\
+import sys
+fp = open(sys.argv[1], 'wb')
+for fname in sys.argv[2:]:
+ fp.write(open(fname, 'rb').read())
+fp.close()
+""")
+
+test.write('sleep.py', """\
+import sys
+import time
+time.sleep(int(sys.argv[1]))
+""")
+
+test.write('SConstruct', """
+# Test case for SCons issue #1608
+# Create a file "foo.in" in the current directory before running scons.
+env = Environment()
+env.Command('foo.out', ['foo.in'], '%(_python_)s cat.py $TARGET $SOURCE && %(_python_)s sleep.py 3')
+env.Command('foobar', ['foo.out'], '%(_python_)s cat.py $TARGET $SOURCES')
+env.Depends('foobar', 'foo.out')
+""" % locals())
+
+test.write('foo.in', "foo.in\n")
+
+test.run(arguments = '-j2 .')
+
+test.must_match('foo.out', "foo.in\n")
+test.must_match('foobar', "foo.in\n")
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that applying env.Tool('qt') after running Configure checks
+works properly. This was broken in 0.96.95.
+
+The configuration here is a moderately stripped-down version of the
+real-world configuration for lprof (lprof.sourceforge.net). It's probably
+not completely minimal, but we're leaving it as since it represents a
+good real-world sanity check on the interaction of some key subsystems.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+import os
+import os.path
+
+def DoWithVariables(variables, prefix, what):
+ saved_variables = { }
+ for name in variables.keys():
+ saved_variables[ name ] = env[ name ][:]
+ env[ name ].append(variables[ name ])
+
+ result = what()
+
+ for name in saved_variables.keys():
+ env[ name ] = saved_variables[ name ]
+ env[ prefix+name ] = variables[ name ]
+
+ return result
+
+def CheckForQtAt(context, qtdir):
+ context.Message('Checking for Qt at %s... ' % qtdir)
+ libp = os.path.join(qtdir, 'lib')
+ cppp = os.path.join(qtdir, 'include')
+ result = AttemptLinkWithVariables(context,
+ { "LIBS": "qt-mt", "LIBPATH": libp , "CPPPATH": cppp },
+ '''
+#include <qapplication.h>
+int main(int argc, char **argv) {
+ QApplication qapp(argc, argv);
+ return 0;
+}
+''',".cpp","QT_")
+ context.Result(result)
+ return result
+
+def CheckForQt(context):
+ # list is currently POSIX centric - what happens with Windows?
+ potential_qt_dirs = [
+ "/usr/share/qt3", # Debian unstable
+ "/usr/share/qt",
+ "/usr",
+ "/usr/local",
+ "/usr/lib/qt3", # Suse
+ "/usr/lib/qt",
+ "/usr/qt/3", # Gentoo
+ "/usr/pkg/qt3" # pkgsrc (NetBSD)
+ ]
+
+ if os.environ.has_key('QTDIR'):
+ potential_qt_dirs.insert(0, os.environ[ 'QTDIR' ])
+
+ if env[ 'qt_directory' ] != "/":
+ uic_path = os.path.join(env['qt_directory'], 'bin', 'uic')
+ if os.path.isfile(uic_path):
+ potential_qt_dirs.insert(0, env[ 'qt_directory' ])
+ else:
+ print "QT not found. Invalid qt_directory value - failed to find uic."
+ return 0
+
+ for i in potential_qt_dirs:
+ context.env.Replace(QTDIR = i)
+ if CheckForQtAt(context, i):
+ # additional checks to validate QT installation
+ if not os.path.isfile(os.path.join(i, 'bin', 'uic')):
+ print "QT - failed to find uic."
+ return 0
+ if not os.path.isfile(os.path.join(i, 'bin', 'moc')):
+ print "QT - failed to find moc."
+ return 0
+ if not os.path.exists(os.path.join(i, 'lib')):
+ print "QT - failed to find QT lib path."
+ return 0
+ if not os.path.exists(os.path.join(i, 'include')):
+ print "QT - failed to find QT include path."
+ return 0
+ return 1
+ else:
+ if i==env['qt_directory']:
+ print "QT directory not valid. Failed QT test build."
+ return 0
+ return 0
+
+def AttemptLinkWithVariables(context, variables, code, extension, prefix):
+ return DoWithVariables(variables,
+ prefix,
+ lambda c=context, code=code, e=extension:
+ c.TryLink(code, e))
+
+env = Environment(CPPPATH=['.'], LIBPATH=['.'], LIBS=[])
+
+opts = Options('lprof.conf')
+opts.Add(PathOption("qt_directory", "Path to Qt directory", "/"))
+opts.Update(env)
+
+env['QT_LIB'] = 'qt-mt'
+config = env.Configure(custom_tests = {
+ 'CheckForQt' : CheckForQt,
+})
+
+if not config.CheckForQt():
+ print "Failed to find valid QT environment."
+ Exit(1)
+
+env.Tool('qt', ['$TOOL_PATH'])
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that sections of LaTeX output that use auxiliary files (a
+bibliography in our configuration below) are consistent when re-run
+after modifying the input file.
+
+This checks for a bug that was triggered by the presence of auxiliary
+files which were detected by SCons but then removed prior to invoking
+TeX, causing the auxiliary sections to be excluded from the output.
+That was fixed (courtesy Joel B. Mohler) by making all the relevant
+auxiliary files Precious().
+
+Test configuration courtesy Dmitry Mikhin.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+dvips = test.where_is('dvips')
+latex = test.where_is('latex')
+
+if not dvips or not latex:
+ test.skip_test("Could not find dvips or latex; skipping test(s).\n")
+
+
+test.subdir(['docs'])
+
+test.write(['SConstruct'], """\
+env = Environment(tools = ['pdftex', 'dvipdf', 'dvips', 'tex', 'latex'],
+ ENV = {},
+ BUILD_DIR = '#build/docs')
+
+# Use 'duplicate=1' because LaTeX toolchain does not work properly for
+# input/output files outside of the current directory
+
+env.BuildDir('$BUILD_DIR', 'docs', duplicate=1)
+env.SConscript('$BUILD_DIR/SConscript', exports = ['env'])
+""")
+
+test.write(['docs', 'SConscript'], """\
+Import('env')
+envc = env.Clone()
+
+test_dvi = envc.DVI(source='test.tex')
+test_ps = envc.PostScript(source='test.tex')
+test_pdf = envc.PDF(source='test.tex')
+
+envc.Default(test_dvi)
+envc.Default(test_ps)
+envc.Default(test_pdf)
+""")
+
+test.write(['docs', 'my.bib'], """\
+@ARTICLE{Mikhin,
+ author = "Dmitry {\uppercase{Y}u}. Mikhin",
+ title = "Blah!",
+ journal = "Some yellow paper",
+ year = "2007",
+ volume = "7",
+ number = "3",
+ pages = "1--2"
+}
+""")
+
+tex_input = r"""\documentclass{article}
+
+\title{BUG IN SCONS}
+
+\author{Dmitry Yu. Mikhin}
+
+\begin{document}
+
+\maketitle
+
+
+\begin{abstract}
+\noindent A bug in BibTeX processing?
+\end{abstract}
+
+
+\section{The problem}
+
+Provide a citation here: \cite{Mikhin}.
+
+
+\bibliography{my}
+\bibliographystyle{unsrtnat}
+
+\end{document}
+"""
+
+test.write(['docs', 'test.tex'], tex_input)
+
+test.run(stderr=None)
+
+pdf_output_1 = test.read(['build', 'docs', 'test.pdf'])
+ps_output_1 = test.read(['build', 'docs', 'test.ps'])
+
+# Adding blank lines will cause SCons to re-run the builds, but the
+# actual contents of the output files shouldn't be any different.
+# This assumption won't work if it's ever used with a toolchain that does
+# something to the output like put a commented-out timestamp in a header.
+test.write(['docs', 'test.tex'], tex_input + "\n\n\n")
+
+test.run(stderr=None)
+
+pdf_output_2 = test.read(['build', 'docs', 'test.pdf'])
+ps_output_2 = test.read(['build', 'docs', 'test.ps'])
+
+test.fail_test(pdf_output_1 != pdf_output_2)
+test.fail_test(ps_output_1 != ps_output_2)
+
+test.pass_test()
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that we re-run LaTeX after running BibTeX in response to
+changes in a .bib file.
+
+Thanks to Rob Managan for the patch that fixed this, and to Joel B. Mohler
+for code clean up and packaging the test case.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write(['SConstruct'], """\
+PDF( 'bibtest.tex' )
+""")
+
+test.write(['bibtest.tex'], r"""
+\documentclass{article}
+\begin{document}
+Learn about cool math in \cite{koblitz:elliptic_curves}.
+\bibliographystyle{alpha}
+\bibliography{sources}
+\end{document}
+""")
+
+sources_bib_content = r"""
+@book{koblitz:elliptic_curves,
+ author = "Neal Koblitz",
+ title = "Elliptic Curves and Modular Forms",
+ year = "%s",
+ publisher = "Springer-Verlag New York Inc."
+}
+"""
+
+
+
+test.write('sources.bib', sources_bib_content % '1981')
+
+test.run()
+
+pdf_output_1 = test.read('bibtest.pdf')
+
+
+
+test.write('sources.bib', sources_bib_content % '1982')
+
+test.run()
+
+pdf_output_2 = test.read('bibtest.pdf')
+
+# If the PDF file is the same as it was previously, then it didn't
+# pick up the change from 1981 to 1982, so fail.
+test.fail_test(pdf_output_1 == pdf_output_2)
+
+
+
+# Double-check: clean everything and rebuild from scratch, which
+# should force the PDF file to be the 1982 version.
+
+test.run(arguments = '-c')
+
+test.run()
+
+pdf_output_3 = test.read('bibtest.pdf')
+
+# If the PDF file is now different than the second run, then something
+# else odd has happened, so fail. (Note that this test will be incorrect
+# if the tool does something like insert a timestamp in the PDF file.)
+test.fail_test(pdf_output_2 != pdf_output_3)
+
+
+
+test.pass_test()
if not tex and not latex:
test.skip_test("Could not find tex or latex; skipping test(s).\n")
-test.subdir('work1', 'work2')
+test.subdir('work1', 'work2', 'work4')
input_file = r"""
\end{document}
"""
+input_file2 = r"""
+\documentclass{article}
+\begin{document}
+Hello world.
+% \bibliography{fooref}
+% \bibliographystyle{plain}
+\end{document}
+"""
+
bibfile = r"""
@Article{X,
author = "Mr. X",
print foo_log
test.fail_test(1)
+
+
if latex:
test.write(['work2', 'SConstruct'], """\
print foo_log
test.fail_test(1)
+
+
+ test.write(['work4', 'SConstruct'], """\
+DVI( "foo.ltx" )
+""")
+ test.write(['work4', 'foo.ltx'], input_file2)
+
+ test.run(chdir = 'work4', arguments = '.')
+
+ test.up_to_date(chdir = 'work4', arguments = '.')
+
+
test.pass_test()
import TestSCons
import string
import sys
+
_python_ = TestSCons._python_
_exe = TestSCons._exe
-_dll = TestSCons._dll
-dll_ = TestSCons.dll_
+
+def dll(s):
+ return TestSCons.dll_ + s + TestSCons._dll
+
test = TestSCons.TestSCons()
test.subdir('gnutools')
test.run(chdir='work1')
-def testObject(test, obj, command, flags):
+def testObject(test, obj, expect):
contents = test.read(test.workpath('work1', obj))
line1 = string.split(contents,'\n')[0]
- items = string.split(line1, ' ')
- cmd = ''
- for i in items:
- if i != '':
- if cmd:
- cmd = cmd + ' ' + i
- else:
- cmd = i
- res = ((flags and (cmd == command + ' ' + flags)) or
- (not flags and (cmd == command)))
- if not res: print "'"+obj+command+flags+"'"+"!='"+str(line1)+"'"
- return res
-
-if sys.platform == 'cygwin':
- fpic = ''
+ actual = string.join(string.split(line1))
+ if not expect == actual:
+ print "%s: %s != %s\n" % (obj, repr(expect), repr(actual))
+ test.fail_test()
+
+if sys.platform in ('win32', 'cygwin'):
+ c_fpic = ''
else:
- fpic = ' -fPIC'
-
-test.fail_test(not testObject(test, 'cfile1.o', 'gcc', '-c') or
- not testObject(test, 'cfile2.o', 'gcc', '-c') or
- not testObject(test, 'cppfile1.o', 'g++', '-c') or
- not testObject(test, 'cppfile2.o', 'g++', '-c') or
- not testObject(test, 'cfile1.os', 'gcc', '-c' + fpic) or
- not testObject(test, 'cfile2.os', 'gcc', '-c' + fpic) or
- not testObject(test, 'cppfile1.os', 'g++', '-c' + fpic) or
- not testObject(test, 'cppfile2.os', 'g++', '-c' + fpic) or
- not testObject(test, 'c-only' + _exe, 'gcc', '') or
- not testObject(test, 'cpp-only' + _exe, 'g++', '') or
- not testObject(test, 'c-and-cpp' + _exe, 'g++', '') or
- not testObject(test, dll_ + 'c-only' + _dll, 'gcc', '-shared') or
- not testObject(test, dll_ + 'cpp-only' + _dll, 'g++', '-shared') or
- not testObject(test, dll_ + 'c-and-cpp' + _dll, 'g++', '-shared'))
+ c_fpic = ' -fPIC'
+
+testObject(test, 'cfile1.o', 'gcc -c')
+testObject(test, 'cfile2.o', 'gcc -c')
+testObject(test, 'cppfile1.o', 'g++ -c')
+testObject(test, 'cppfile2.o', 'g++ -c')
+testObject(test, 'cfile1.os', 'gcc -c' + c_fpic)
+testObject(test, 'cfile2.os', 'gcc -c' + c_fpic)
+testObject(test, 'cppfile1.os', 'g++ -c -fPIC')
+testObject(test, 'cppfile2.os', 'g++ -c -fPIC')
+testObject(test, 'c-only' + _exe, 'gcc')
+testObject(test, 'cpp-only' + _exe, 'g++')
+testObject(test, 'c-and-cpp' + _exe, 'g++')
+testObject(test, dll('c-only'), 'gcc -shared')
+testObject(test, dll('cpp-only'), 'g++ -shared')
+testObject(test, dll('c-and-cpp'), 'g++ -shared')
test.pass_test()
for platform in platforms:
test.write('SConstruct', """
+print "Platform %(platform)s"
env = Environment(platform = '%(platform)s')
import SCons.Platform.%(platform)s
x = SCons.Platform.%(platform)s.generate
# An SConstruct for importing Tool names that have illegal characters
# for Python variable names.
indirect_import = """\
+print "Tool %(tool)s (indirect)"
env = Environment(tools = ['%(tool)s'])
SCons = __import__('SCons.Tool.%(tool)s', globals(), locals(), [])
# An SConstruct for importing Tool names "normally."
direct_import = """\
+print "Tool %(tool)s (direct)"
env = Environment(tools = ['%(tool)s'])
import SCons.Tool.%(tool)s
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import string
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+env = Environment()
+""")
+
+test.run(arguments = "--debug=pdb", stdin = "n\ns\nq\n")
+test.fail_test(string.find(test.stdout(), "(Pdb)") == -1)
+test.fail_test(string.find(test.stdout(), "SCons") == -1)
+
+test.pass_test()
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import sys
-import string
-import re
-import time
-
import TestSCons
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
-test.write('SConstruct', """
-env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx')
-env.Program('foo', Split('foo.c bar.c'))
-""")
-
-test.write('foo.c', r"""
-#include "foo.h"
-int main(int argc, char *argv[])
-{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
-}
-""")
-
-test.write('bar.c', """
-#include "bar.h"
-""")
-
-test.write('foo.h', """
-#ifndef FOO_H
-#define FOO_H
-#include "bar.h"
-#endif
-""")
-
-test.write('bar.h', """
-#ifndef BAR_H
-#define BAR_H
-#include "foo.h"
-#endif
-""")
-
-############################
-# test --debug=pdb
-
-test.run(arguments = "--debug=pdb", stdin = "n\ns\nq\n")
-test.fail_test(string.find(test.stdout(), "(Pdb)") == -1)
-test.fail_test(string.find(test.stdout(), "SCons") == -1)
-
-############################
-# test --debug=presub
-
test.write('cat.py', """\
import sys
open(sys.argv[2], "wb").write(open(sys.argv[1], "rb").read())
TEMP = Builder(action="$TEMPCOM")
LIST = Builder(action="$LISTCOM")
FUNC = Builder(action=cat)
-env = Environment(PYTHON='%(_python_)s',
+env = Environment(PYTHON=r'%(_python_)s',
BUILDERS = {'FILE':FILE, 'TEMP':TEMP, 'LIST':LIST, 'FUNC':FUNC},
FILECOM="$PYTHON cat.py $SOURCES $TARGET",
TEMPCOM="$PYTHON cat.py $SOURCES temp\\n$PYTHON cat.py temp $TARGET",
env.LIST('file16.out', 'file16.in')
env.FUNC('file17.out', 'file17.in')
env.FUNC('file18.out', 'file18.in')
+
+env2 = Environment(PYTHON=r'%(_python_)s',
+ CCCOM="$PYTHON cat.py $SOURCES $TARGET")
+env2.Object('file20.obj', 'file20.c')
""" % locals())
test.write('file01.in', "file01.in\n")
test.write('file17.in', "file17.in\n")
test.write('file18.in', "file18.in\n")
+test.write('file20.c', "file20.c\n")
+
expect = """\
Building file01.out with action:
$PYTHON cat.py $SOURCES $TARGET
Building file18.out with action:
cat(target, source, env)
cat(["file18.out"], ["file18.in"])
+Building file20.obj with action:
+ $PYTHON cat.py $SOURCES $TARGET
+%(_python_)s cat.py file20.c file20.obj
""" % locals()
test.run(arguments = "--debug=presub .", stdout=test.wrap_stdout(expect))
test.must_match('file17.out', "file17.in\n")
test.must_match('file18.out', "file18.in\n")
+test.must_match('file20.obj', "file20.c\n")
+
test.pass_test()
import re
import time
+_python_ = TestSCons._python_
+
test = TestSCons.TestSCons()
-test.write('SConstruct', """
-env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx')
-env.Program('foo', Split('foo.c bar.c'))
+test.write('sleep_cat.py', """\
+import sys
+import time
+time.sleep(int(sys.argv[1]))
+fp = open(sys.argv[2], 'wb')
+for arg in sys.argv[3:]:
+ fp.write(open(arg, 'rb').read())
+fp.close()
+sys.exit(0)
""")
-test.write('foo.c', r"""
-#include <stdio.h>
-#include <stdlib.h>
-#include "foo.h"
-int main(int argc, char *argv[])
-{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
-}
-""")
+test.write('SConstruct', """
+env = Environment(PYTHON = r'%(_python_)s',
+ SLEEP_CAT = r'sleep_cat.py',
+ CATCOM = '$PYTHON $SLEEP_CAT $SECONDS $TARGET $SOURCES',
+ SECONDS = ARGUMENTS.get('SLEEP', '0'))
+f1 = env.Command('f1.out', 'f1.in', '$CATCOM')
+f2 = env.Command('f2.out', 'f2.in', '$CATCOM')
+f3 = env.Command('f3.out', 'f3.in', '$CATCOM')
+f4 = env.Command('f4.out', 'f4.in', '$CATCOM')
+env.Command('output', [f1, f2, f3, f4], '$CATCOM')
+""" % locals())
-test.write('bar.c', """
-#include "bar.h"
-""")
+test.write('f1.in', "f1.in\n")
+test.write('f2.in', "f2.in\n")
+test.write('f3.in', "f3.in\n")
+test.write('f4.in', "f4.in\n")
-test.write('foo.h', """
-#ifndef FOO_H
-#define FOO_H
-#include "bar.h"
-#endif
-""")
-test.write('bar.h', """
-#ifndef BAR_H
-#define BAR_H
-#include "foo.h"
-#endif
-""")
-def num(match, line):
- return float(re.search(match, line).group(1))
+def num(s, match):
+ return float(re.search(match, s).group(1))
+
+def within_tolerance(expected, actual, tolerance):
+ return abs((expected-actual)/actual) <= tolerance
+
+
-# Try to make things a little more equal by measuring Python overhead
-# executing a minimal file, and reading the scons.py script itself from
-# disk so that it's already been cached.
+# Try to make our results a little more accurate and repeatable by
+# measuring Python overhead executing a minimal file, and reading the
+# scons.py script itself from disk so that it's already been cached.
test.write('pass.py', "pass\n")
test.read(test.program)
test.run(program=TestSCons.python, arguments=test.workpath('pass.py'))
overhead = time.time() - start_time
+
+
start_time = time.time()
-test.run(arguments = "--debug=time .")
+test.run(arguments = "-j1 --debug=time . SLEEP=0")
complete_time = time.time() - start_time
+
+
expected_total_time = complete_time - overhead
-lines = string.split(test.stdout(), '\n')
-expected_command_time = 0.0
-for cmdline in filter(lambda x: x[:23] == "Command execution time:", lines):
- n = num(r'Command execution time: (\d+\.\d+) seconds', cmdline)
- expected_command_time = expected_command_time + n
+pattern = r'Command execution time: (\d+\.\d+) seconds'
+times = map(float, re.findall(pattern, test.stdout()))
+expected_command_time = reduce(lambda x, y: x + y, times, 0.0)
-stdout = test.stdout()
-total_time = num(r'Total build time: (\d+\.\d+) seconds', stdout)
-sconscript_time = num(r'Total SConscript file execution time: (\d+\.\d+) seconds', stdout)
-scons_time = num(r'Total SCons execution time: (\d+\.\d+) seconds', stdout)
-command_time = num(r'Total command execution time: (\d+\.\d+) seconds', stdout)
+stdout = test.stdout()
-def within_tolerance(expected, actual, tolerance):
- return abs((expected-actual)/actual) <= tolerance
+total_time = num(stdout, r'Total build time: (\d+\.\d+) seconds')
+sconscript_time = num(stdout, r'Total SConscript file execution time: (\d+\.\d+) seconds')
+scons_time = num(stdout, r'Total SCons execution time: (\d+\.\d+) seconds')
+command_time = num(stdout, r'Total command execution time: (\d+\.\d+) seconds')
failures = []
if not within_tolerance(expected_command_time, command_time, 0.01):
failures.append("""\
-SCons reported a total command execution time of %s,
-but command execution times really totalled %s,
+SCons -j1 reported a total command execution time of %(command_time)s,
+but command execution times really totalled %(expected_command_time)s,
outside of the 1%% tolerance.
-""" % (command_time, expected_command_time))
+""" % locals())
added_times = sconscript_time+scons_time+command_time
if not within_tolerance(total_time, added_times, 0.01):
failures.append("""\
-SCons reported a total build time of %s,
-but the various execution times actually totalled %s,
+SCons -j1 reported a total build time of %(total_time)s,
+but the various execution times actually totalled %(added_times)s,
outside of the 1%% tolerance.
-""" % (total_time, added_times))
+""" % locals())
if not within_tolerance(total_time, expected_total_time, 0.15):
failures.append("""\
-SCons reported total build time of %s,
-but the actual measured build time was %s
-(end-to-end time of %s less Python overhead of %s),
+SCons -j1 reported total build time of %(total_time)s,
+but the actual measured build time was %(expected_total_time)s
+(end-to-end time of %(complete_time)s less Python overhead of %(overhead)s),
outside of the 15%% tolerance.
-""" % (total_time, expected_total_time, complete_time, overhead))
+""" % locals())
if failures:
print string.join([test.stdout()] + failures, '\n')
test.fail_test(1)
+
+
+test.run(arguments = "-c")
+
+test.run(arguments = "-j4 --debug=time . SLEEP=1")
+
+
+
+stdout = test.stdout()
+
+total_time = num(stdout, r'Total build time: (\d+\.\d+) seconds')
+sconscript_time = num(stdout, r'Total SConscript file execution time: (\d+\.\d+) seconds')
+scons_time = num(stdout, r'Total SCons execution time: (\d+\.\d+) seconds')
+command_time = num(stdout, r'Total command execution time: (\d+\.\d+) seconds')
+
+failures = []
+
+added_times = sconscript_time+scons_time+command_time
+if not within_tolerance(total_time, added_times, 0.01):
+ failures.append("""\
+SCons -j4 reported a total build time of %(total_time)s,
+but the various execution times actually totalled %(added_times)s,
+outside of the 1%% tolerance.
+""" % locals())
+
+if failures:
+ print string.join([test.stdout()] + failures, '\n')
+ test.fail_test(1)
+
+
test.pass_test()
print e.subst('no site: M4 is $M4, M4_MINE is $M4_MINE')
""")
-test.run(arguments = '-Q --no-site-dir .',
-stdout = """no site: M4 is m4, M4_MINE is
-scons: `.' is up to date.\n""")
+test.run(arguments = '-Q --no-site-dir .')
+
+not_expected = """Hi there, I am in site_scons/site_init.py!
+no site: M4 is my_m4, M4_MINE is 1
+scons: `.' is up to date.
+"""
+
+test.fail_test(test.stdout() == not_expected)
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the site_scons dir is added to sys.path as an
+absolute path, so it will work from a subdir.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons')
+test.subdir('sub1')
+
+test.write(['site_scons', 'testmod1.py'], """
+print "Imported site_scons/testmod1.py."
+""")
+test.write(['site_scons', 'testmod2.py'], """
+print "Imported site_scons/testmod2.py."
+""")
+
+test.write(['sub1', 'SConscript'], """
+import sys
+import testmod2 # This call did not work before the fix
+
+""")
+
+test.write('SConstruct', """
+import sys
+import testmod1 # this always worked
+SConscript('sub1/SConscript')
+""")
+
+test.run(arguments = '-Q .',
+ stdout = """Imported site_scons/testmod1.py.
+Imported site_scons/testmod2.py.
+scons: `.' is up to date.\n""")
+
+test.pass_test()
+
+# end of file