diff options
Diffstat (limited to 'src/engine/SCons')
62 files changed, 709 insertions, 399 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index dd7009c..438588b 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -268,8 +268,6 @@ class _ActionAction(ActionBase): 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: @@ -290,7 +288,10 @@ class _ActionAction(ActionBase): 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 diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 8339610..08373c3 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -484,6 +484,13 @@ class _ActionActionTestCase(unittest.TestCase): 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() diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 51af90b..ecc93c0 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -815,9 +815,15 @@ class BuilderBase: (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): diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index 77ac9f4..bb5a69a 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -582,7 +582,9 @@ class BuilderTestCase(unittest.TestCase): "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) @@ -804,11 +806,6 @@ class BuilderTestCase(unittest.TestCase): 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') @@ -979,8 +976,6 @@ class BuilderTestCase(unittest.TestCase): 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 @@ -1011,6 +1006,7 @@ class BuilderTestCase(unittest.TestCase): 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 @@ -1131,6 +1127,7 @@ class BuilderTestCase(unittest.TestCase): 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 @@ -1405,11 +1402,6 @@ class BuilderTestCase(unittest.TestCase): 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' diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 11bace3..23d02e9 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -202,13 +202,12 @@ def installStr(dest, source, env): 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 @@ -219,6 +218,16 @@ def _concat(prefix, list, suffix, env, f=lambda x: x, target=None, source=None): 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 @@ -275,8 +284,68 @@ def _stripixes(prefix, list, suffix, stripprefix, stripsuffix, env, c=None): 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): @@ -304,7 +373,7 @@ def _defines(prefix, defs, suffix, env, c=_concat): 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 diff --git a/src/engine/SCons/Memoize.py b/src/engine/SCons/Memoize.py index 6a46350..c2b4181 100644 --- a/src/engine/SCons/Memoize.py +++ b/src/engine/SCons/Memoize.py @@ -145,7 +145,10 @@ class Counter: 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): """ diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 4d269d2..a16fee4 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1929,7 +1929,14 @@ class File(Base): 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(): diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py index 81b8135..943e9ad 100644 --- a/src/engine/SCons/PathList.py +++ b/src/engine/SCons/PathList.py @@ -36,6 +36,7 @@ import os import string import SCons.Memoize +import SCons.Node import SCons.Util # @@ -58,10 +59,13 @@ def node_conv(obj): 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: """ @@ -95,9 +99,7 @@ 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 = [] @@ -129,6 +131,11 @@ class _PathList: 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) @@ -175,18 +182,19 @@ class PathListCache: """ 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): diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py index d6fae0e..d0ba2a0 100644 --- a/src/engine/SCons/PathListTests.py +++ b/src/engine/SCons/PathListTests.py @@ -23,6 +23,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys import unittest import SCons.PathList @@ -48,20 +49,38 @@ class subst_pathTestCase(unittest.TestCase): 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 diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 6a0ad81..ca7f68c 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -74,6 +74,9 @@ import SCons.Warnings display = SCons.Util.display progress_display = SCons.Util.DisplayEngine() +first_command_start = None +last_command_end = None + # Task control. # class BuildTask(SCons.Taskmaster.Task): @@ -88,12 +91,17 @@ 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(): @@ -320,10 +328,10 @@ print_stacktrace = 0 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() @@ -617,7 +625,7 @@ def _load_site_scons_dir(topdir, site_dir_name=None): 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): @@ -1354,9 +1362,10 @@ def _main(args, parser): 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) @@ -1413,6 +1422,7 @@ def _exec_main(): def main(): global exit_status + global first_command_start try: _exec_main() @@ -1453,11 +1463,15 @@ def 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) diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 35bbbf7..fde4997 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -122,7 +122,6 @@ ignore_errors = Main.ignore_errors #exit_status = Main.exit_status #profiling = Main.profiling repositories = Main.repositories -#num_jobs = Main.num_jobs # settable by SConscript.SetJobs() # import SConscript diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 7439168..4de35f0 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -50,6 +50,8 @@ interface and the SCons build engine. There are two key classes here: __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.compat + import string import sys import traceback @@ -272,7 +274,11 @@ class Task: """ 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) @@ -572,7 +578,7 @@ class Taskmaster: # 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 @@ -607,7 +613,7 @@ class Taskmaster: # 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: diff --git a/src/engine/SCons/Tool/BitKeeper.xml b/src/engine/SCons/Tool/BitKeeper.xml index 3fef72d..8ab7049 100644 --- a/src/engine/SCons/Tool/BitKeeper.xml +++ b/src/engine/SCons/Tool/BitKeeper.xml @@ -27,14 +27,14 @@ fetching source files using BitKeeper. <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> diff --git a/src/engine/SCons/Tool/CVS.xml b/src/engine/SCons/Tool/CVS.xml index 9ad5fb5..fb666e8 100644 --- a/src/engine/SCons/Tool/CVS.xml +++ b/src/engine/SCons/Tool/CVS.xml @@ -33,7 +33,7 @@ fetch source files from a CVS repository. <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> @@ -51,6 +51,6 @@ to specify from where the files must be fetched. <summary> The path to the CVS repository. This is referenced in the default -&cv-CVSFLAGS; value. +&cv-link-CVSFLAGS; value. </summary> </cvar> diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 09ce1d1..177d579 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -51,8 +51,9 @@ if java_parsing: # 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: @@ -101,20 +102,26 @@ if java_parsing: 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": @@ -129,13 +136,17 @@ if java_parsing: 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): @@ -153,7 +164,10 @@ if java_parsing: 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 diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py index 4a7f9cf..853afd4 100644 --- a/src/engine/SCons/Tool/JavaCommonTests.py +++ b/src/engine/SCons/Tool/JavaCommonTests.py @@ -286,6 +286,50 @@ public abstract class TestClass 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() diff --git a/src/engine/SCons/Tool/Perforce.xml b/src/engine/SCons/Tool/Perforce.xml index 87565af..b8824ed 100644 --- a/src/engine/SCons/Tool/Perforce.xml +++ b/src/engine/SCons/Tool/Perforce.xml @@ -27,7 +27,7 @@ fetch source files from Perforce. <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> diff --git a/src/engine/SCons/Tool/RCS.xml b/src/engine/SCons/Tool/RCS.xml index 5e3b83d..2c89a5b 100644 --- a/src/engine/SCons/Tool/RCS.xml +++ b/src/engine/SCons/Tool/RCS.xml @@ -16,7 +16,7 @@ The RCS executable. 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> @@ -39,13 +39,13 @@ fetch (checkout) source files from RCS. <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> diff --git a/src/engine/SCons/Tool/SCCS.xml b/src/engine/SCons/Tool/SCCS.xml index 822547c..9f7539d 100644 --- a/src/engine/SCons/Tool/SCCS.xml +++ b/src/engine/SCons/Tool/SCCS.xml @@ -27,7 +27,7 @@ fetch source files from SCCS. <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> diff --git a/src/engine/SCons/Tool/__init__.xml b/src/engine/SCons/Tool/__init__.xml index cc7e145..ff50450 100644 --- a/src/engine/SCons/Tool/__init__.xml +++ b/src/engine/SCons/Tool/__init__.xml @@ -8,7 +8,7 @@ See its __doc__ string for a discussion of the format. <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. @@ -28,7 +28,7 @@ env.CFile(target = 'bar', source = 'bar.y') 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. @@ -82,9 +82,9 @@ see that builder method's description for 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. @@ -109,11 +109,11 @@ compiled to object files. 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. @@ -146,12 +146,12 @@ On Windows systems, specifying 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> @@ -186,10 +186,10 @@ and shared objects to be linked into a 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: @@ -218,11 +218,11 @@ compiled to object files. 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. @@ -279,9 +279,9 @@ Source files must have one of the following extensions: </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. diff --git a/src/engine/SCons/Tool/applelink.xml b/src/engine/SCons/Tool/applelink.xml index b9ea63d..d5fadbb 100644 --- a/src/engine/SCons/Tool/applelink.xml +++ b/src/engine/SCons/Tool/applelink.xml @@ -11,8 +11,8 @@ general user-supplied frameworks options to be added at 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> @@ -35,7 +35,7 @@ For example: <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> @@ -57,7 +57,7 @@ a list containing the paths to search for frameworks. 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> @@ -77,7 +77,7 @@ to the compiler and linker command lines. <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> @@ -87,6 +87,6 @@ The default value is <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> diff --git a/src/engine/SCons/Tool/ar.xml b/src/engine/SCons/Tool/ar.xml index 24f886b..b26f634 100644 --- a/src/engine/SCons/Tool/ar.xml +++ b/src/engine/SCons/Tool/ar.xml @@ -26,7 +26,7 @@ The command line used to generate a static library from object files. <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") @@ -55,7 +55,7 @@ The command line used to index a static library archive. <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") diff --git a/src/engine/SCons/Tool/as.xml b/src/engine/SCons/Tool/as.xml index a2447bd..f61d26a 100644 --- a/src/engine/SCons/Tool/as.xml +++ b/src/engine/SCons/Tool/as.xml @@ -27,7 +27,7 @@ from an assembly-language source file. <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") @@ -46,7 +46,8 @@ General options passed to the assembler. 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> @@ -56,7 +57,7 @@ are included on this command line. 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") @@ -69,6 +70,6 @@ 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> diff --git a/src/engine/SCons/Tool/c++.xml b/src/engine/SCons/Tool/c++.xml index eb0a8fe..2dc7bb2 100644 --- a/src/engine/SCons/Tool/c++.xml +++ b/src/engine/SCons/Tool/c++.xml @@ -19,7 +19,8 @@ The C++ compiler. <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> @@ -28,7 +29,7 @@ are included on this command line. <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") @@ -39,10 +40,10 @@ 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> @@ -56,7 +57,8 @@ The C++ compiler used for generating shared-library objects. <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> @@ -65,7 +67,7 @@ are included on this command line. <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") diff --git a/src/engine/SCons/Tool/cc.xml b/src/engine/SCons/Tool/cc.xml index 0ebaf14..b7ff65a 100644 --- a/src/engine/SCons/Tool/cc.xml +++ b/src/engine/SCons/Tool/cc.xml @@ -6,7 +6,21 @@ See its __doc__ string for a discussion of the format. --> <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> @@ -19,8 +33,8 @@ The C compiler. <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> @@ -29,7 +43,7 @@ line. <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") @@ -54,11 +68,16 @@ General options that are passed to the C compiler (C only; not C++). 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 @@ -66,7 +85,7 @@ 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> @@ -99,7 +118,9 @@ The C compiler used for generating shared-library objects. <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> @@ -108,7 +129,7 @@ are included on this command line. <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") diff --git a/src/engine/SCons/Tool/dvi.xml b/src/engine/SCons/Tool/dvi.xml index 9d3110e..26fdd43 100644 --- a/src/engine/SCons/Tool/dvi.xml +++ b/src/engine/SCons/Tool/dvi.xml @@ -17,24 +17,24 @@ if the string 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> diff --git a/src/engine/SCons/Tool/dvipdf.xml b/src/engine/SCons/Tool/dvipdf.xml index 4d82ffe..f0679b3 100644 --- a/src/engine/SCons/Tool/dvipdf.xml +++ b/src/engine/SCons/Tool/dvipdf.xml @@ -32,12 +32,12 @@ The command line used to convert TeX DVI files into a PDF file. <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> diff --git a/src/engine/SCons/Tool/dvips.xml b/src/engine/SCons/Tool/dvips.xml index cb0d7d8..dbfcaf3 100644 --- a/src/engine/SCons/Tool/dvips.xml +++ b/src/engine/SCons/Tool/dvips.xml @@ -18,7 +18,7 @@ from a <filename>.dvi</filename> input file <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: @@ -54,7 +54,7 @@ The command line used to convert TeX DVI files into a PostScript file. <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> diff --git a/src/engine/SCons/Tool/f77.xml b/src/engine/SCons/Tool/f77.xml index c077175..a1d3c34 100644 --- a/src/engine/SCons/Tool/f77.xml +++ b/src/engine/SCons/Tool/f77.xml @@ -13,10 +13,10 @@ XXX <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> @@ -24,9 +24,9 @@ or compiler version for Fortran 77 files. <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> @@ -36,7 +36,7 @@ for all Fortran versions. <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> @@ -49,14 +49,14 @@ Note that this variable does 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. @@ -68,10 +68,10 @@ 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> @@ -80,15 +80,15 @@ of each directory in &cv-F77PATH;. 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. @@ -108,17 +108,17 @@ env = Environment(F77PATH=include) 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") @@ -130,11 +130,11 @@ 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> @@ -143,10 +143,10 @@ for all Fortran versions. <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> @@ -155,9 +155,9 @@ or compiler version for Fortran 77 files. <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> @@ -167,7 +167,7 @@ for all Fortran versions. <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> @@ -176,9 +176,9 @@ If this is not set, then &cv-SHF77COM; or &cv-SHFORTRANCOM; <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. @@ -190,11 +190,11 @@ 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> diff --git a/src/engine/SCons/Tool/f90.xml b/src/engine/SCons/Tool/f90.xml index 5c252cc..9159a24 100644 --- a/src/engine/SCons/Tool/f90.xml +++ b/src/engine/SCons/Tool/f90.xml @@ -13,10 +13,10 @@ XXX <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> @@ -24,9 +24,9 @@ or compiler version for Fortran 90 files. <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> @@ -36,7 +36,7 @@ for all Fortran versions. <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> @@ -49,14 +49,14 @@ Note that this variable does 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. @@ -68,10 +68,10 @@ 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> @@ -80,15 +80,15 @@ of each directory in &cv-F90PATH;. 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. @@ -108,17 +108,17 @@ env = Environment(F90PATH=include) 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") @@ -130,11 +130,11 @@ 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> @@ -143,10 +143,10 @@ for all Fortran versions. <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> @@ -155,9 +155,9 @@ or compiler version for Fortran 90 files. <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> @@ -167,7 +167,7 @@ for all Fortran versions. <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> @@ -176,9 +176,9 @@ If this is not set, then &cv-SHF90COM; or &cv-SHFORTRANCOM; <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. @@ -190,11 +190,11 @@ 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> diff --git a/src/engine/SCons/Tool/f95.xml b/src/engine/SCons/Tool/f95.xml index 86331a4..e3c026e 100644 --- a/src/engine/SCons/Tool/f95.xml +++ b/src/engine/SCons/Tool/f95.xml @@ -13,10 +13,10 @@ XXX <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> @@ -24,9 +24,9 @@ or compiler version for Fortran 95 files. <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> @@ -36,7 +36,7 @@ for all Fortran versions. <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> @@ -49,14 +49,14 @@ Note that this variable does 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. @@ -68,10 +68,10 @@ 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> @@ -80,15 +80,15 @@ of each directory in &cv-F95PATH;. 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. @@ -108,17 +108,17 @@ env = Environment(F95PATH=include) 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") @@ -130,11 +130,11 @@ 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> @@ -143,10 +143,10 @@ for all Fortran versions. <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> @@ -155,9 +155,9 @@ or compiler version for Fortran 95 files. <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> @@ -167,7 +167,7 @@ for all Fortran versions. <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> @@ -176,9 +176,9 @@ If this is not set, then &cv-SHF95COM; or &cv-SHFORTRANCOM; <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. @@ -190,11 +190,11 @@ 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> diff --git a/src/engine/SCons/Tool/fortran.xml b/src/engine/SCons/Tool/fortran.xml index c472343..c7000af 100644 --- a/src/engine/SCons/Tool/fortran.xml +++ b/src/engine/SCons/Tool/fortran.xml @@ -21,8 +21,11 @@ for all versions of Fortran. <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> @@ -31,7 +34,7 @@ are included on this command line. <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> @@ -44,9 +47,9 @@ Note that this variable does 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> @@ -58,10 +61,10 @@ An automatically-generated construction variable 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> @@ -79,8 +82,8 @@ for module files, as well. 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> @@ -89,8 +92,8 @@ when the &cv-_FORTRANMODFLAG; variables is automatically generated. 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> @@ -101,9 +104,10 @@ containing the Fortran compiler command-line option 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> @@ -162,17 +166,17 @@ env = Environment(FORTRANPATH=include) 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") @@ -184,8 +188,11 @@ env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURC <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> @@ -221,7 +228,7 @@ to a shared-library object file. <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> @@ -239,7 +246,8 @@ The command line used to compile a Fortran source file to a 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> diff --git a/src/engine/SCons/Tool/gs.xml b/src/engine/SCons/Tool/gs.xml index d4840d6..9a63e94 100644 --- a/src/engine/SCons/Tool/gs.xml +++ b/src/engine/SCons/Tool/gs.xml @@ -27,7 +27,7 @@ The Ghostscript command line used to convert PostScript to PDF files. 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> diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py index d95a4be..2d0a5a5 100644 --- a/src/engine/SCons/Tool/intelc.py +++ b/src/engine/SCons/Tool/intelc.py @@ -353,7 +353,9 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): 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 diff --git a/src/engine/SCons/Tool/jar.xml b/src/engine/SCons/Tool/jar.xml index 45d9ebc..488459b 100644 --- a/src/engine/SCons/Tool/jar.xml +++ b/src/engine/SCons/Tool/jar.xml @@ -14,7 +14,7 @@ XXX <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> @@ -59,7 +59,7 @@ The command line used to call the Java archive tool. <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") diff --git a/src/engine/SCons/Tool/javac.xml b/src/engine/SCons/Tool/javac.xml index 86fd507..400a23b 100644 --- a/src/engine/SCons/Tool/javac.xml +++ b/src/engine/SCons/Tool/javac.xml @@ -63,7 +63,7 @@ The Java compiler. 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> @@ -73,7 +73,7 @@ are included on this command line. 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") diff --git a/src/engine/SCons/Tool/javah.xml b/src/engine/SCons/Tool/javah.xml index 84d0068..75d0efb 100644 --- a/src/engine/SCons/Tool/javah.xml +++ b/src/engine/SCons/Tool/javah.xml @@ -24,7 +24,7 @@ or the objects returned from the 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; @@ -62,7 +62,7 @@ The Java generator for C header and stub files. <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> @@ -71,7 +71,7 @@ are included on this command line. <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") diff --git a/src/engine/SCons/Tool/latex.xml b/src/engine/SCons/Tool/latex.xml index 96c0f4a..35eea30 100644 --- a/src/engine/SCons/Tool/latex.xml +++ b/src/engine/SCons/Tool/latex.xml @@ -26,7 +26,7 @@ The command line used to call the LaTeX structured formatter and typesetter. <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") @@ -45,7 +45,7 @@ General options passed to the LaTeX structured formatter and typesetter. 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. diff --git a/src/engine/SCons/Tool/lex.xml b/src/engine/SCons/Tool/lex.xml index 51401dc..d67feb0 100644 --- a/src/engine/SCons/Tool/lex.xml +++ b/src/engine/SCons/Tool/lex.xml @@ -27,7 +27,7 @@ to generate a source file. <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") diff --git a/src/engine/SCons/Tool/link.xml b/src/engine/SCons/Tool/link.xml index 52694ad..0728dda 100644 --- a/src/engine/SCons/Tool/link.xml +++ b/src/engine/SCons/Tool/link.xml @@ -13,23 +13,24 @@ XXX <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> @@ -44,7 +45,7 @@ General user options passed to the linker for building loadable modules. 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> @@ -73,7 +74,7 @@ The command line used to link object files into an executable. <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") @@ -88,17 +89,17 @@ Note that this variable should <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> @@ -119,7 +120,7 @@ The command line used to link programs using shared libaries. <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") @@ -134,17 +135,17 @@ Note that this variable should <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> diff --git a/src/engine/SCons/Tool/m4.xml b/src/engine/SCons/Tool/m4.xml index 7a0f9c3..0ee421e 100644 --- a/src/engine/SCons/Tool/m4.xml +++ b/src/engine/SCons/Tool/m4.xml @@ -13,7 +13,7 @@ XXX <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 @@ -42,7 +42,7 @@ The command line used to pass files through the M4 macro preprocessor. <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> diff --git a/src/engine/SCons/Tool/mslink.xml b/src/engine/SCons/Tool/mslink.xml index 6499cfe..160d415 100644 --- a/src/engine/SCons/Tool/mslink.xml +++ b/src/engine/SCons/Tool/mslink.xml @@ -49,7 +49,7 @@ Using the <option>/Zi</option> instead may yield improved 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> @@ -75,7 +75,7 @@ is passed a keyword argument of <literal>register=1</literal>. <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> @@ -92,31 +92,31 @@ and requiring user attention. <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> diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 5c9eaf0..c6fe461 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -138,12 +138,13 @@ def _parse_msvc8_overrides(version,platform,suite): 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, diff --git a/src/engine/SCons/Tool/msvc.xml b/src/engine/SCons/Tool/msvc.xml index be155bd..0ea2602 100644 --- a/src/engine/SCons/Tool/msvc.xml +++ b/src/engine/SCons/Tool/msvc.xml @@ -53,7 +53,7 @@ Options added to the compiler command line 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> @@ -64,7 +64,7 @@ to support storing debugging information in a 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>. @@ -78,7 +78,7 @@ 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 as follows: +switch by overriding the default &cv-link-CCPDBFLAGS; variable as follows: <example> import SCons.Util @@ -88,7 +88,7 @@ env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s" % File(PDB)) or "" 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' @@ -123,7 +123,7 @@ builder to generated a precompiled header. <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> @@ -160,7 +160,7 @@ a Microsoft Visual C++ resource file. <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> diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index b84b277..db8e8fd 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -1385,10 +1385,7 @@ def get_msvs_install_dirs(version = None, vs8suite = None): # 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... @@ -1403,23 +1400,51 @@ def get_msvs_install_dirs(version = None, vs8suite = None): 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: @@ -1704,9 +1729,9 @@ def generate(env): 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: @@ -1746,7 +1771,11 @@ def exists(env): 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: diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index c16beaa..07fda0c 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -18,13 +18,13 @@ and by default builds a solution file as well. 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, @@ -56,7 +56,7 @@ These are currently limited to 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. @@ -77,7 +77,7 @@ 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). @@ -154,7 +154,7 @@ This builds a Visual Studio solution 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 construction environment). For Visual Studio 6, it will generate a <filename>.dsw</filename> @@ -169,7 +169,7 @@ The following values must be specified: <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>: @@ -184,12 +184,13 @@ A list of project file names, or Project nodes returned by calls to the &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> @@ -479,7 +480,8 @@ The action used to generate Microsoft Visual Studio project files. 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. @@ -528,7 +530,7 @@ file) 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 @@ -561,7 +563,7 @@ The (optional) path to the SCons library directory, 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> diff --git a/src/engine/SCons/Tool/pdf.xml b/src/engine/SCons/Tool/pdf.xml index 3d64be2..1e447dd 100644 --- a/src/engine/SCons/Tool/pdf.xml +++ b/src/engine/SCons/Tool/pdf.xml @@ -12,7 +12,7 @@ from a <filename>.dvi</filename> input file <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: diff --git a/src/engine/SCons/Tool/qt.xml b/src/engine/SCons/Tool/qt.xml index 6a4ac78..4b11cbc 100644 --- a/src/engine/SCons/Tool/qt.xml +++ b/src/engine/SCons/Tool/qt.xml @@ -14,7 +14,7 @@ XXX <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> @@ -35,7 +35,7 @@ files to the &b-Program;, 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> @@ -56,7 +56,9 @@ with python's os.path.join() method, 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, @@ -110,15 +112,16 @@ specify files to run moc on. <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> @@ -132,22 +135,23 @@ Prints lots of debugging information while scanning for moc files. <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> @@ -180,7 +184,7 @@ Command to generate a moc file from a cpp file. <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> @@ -193,7 +197,7 @@ Command to generate a moc file from a header. <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> @@ -212,14 +216,14 @@ Default value is 'moc_'. Prefix for moc output files, when source is a header. <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> @@ -232,7 +236,7 @@ Command to generate header files from .ui files. <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> @@ -270,7 +274,7 @@ Default value is 'uic_'. Prefix for uic generated implementation files. <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> diff --git a/src/engine/SCons/Tool/rmic.xml b/src/engine/SCons/Tool/rmic.xml index 1fe4bd8..63511e5 100644 --- a/src/engine/SCons/Tool/rmic.xml +++ b/src/engine/SCons/Tool/rmic.xml @@ -24,7 +24,7 @@ or the objects return from the 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; @@ -59,7 +59,7 @@ The Java RMI stub compiler. 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> @@ -69,7 +69,7 @@ are included on this command line. 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") diff --git a/src/engine/SCons/Tool/rpcgen.xml b/src/engine/SCons/Tool/rpcgen.xml index 74fc3be..a3adb22 100644 --- a/src/engine/SCons/Tool/rpcgen.xml +++ b/src/engine/SCons/Tool/rpcgen.xml @@ -85,7 +85,7 @@ The RPC protocol compiler. 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> @@ -101,7 +101,7 @@ General options passed to the RPC protocol compiler. 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> @@ -111,7 +111,7 @@ construction variable. 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> @@ -121,7 +121,7 @@ construction variable. 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> diff --git a/src/engine/SCons/Tool/swig.xml b/src/engine/SCons/Tool/swig.xml index 0bdda96..05faff2 100644 --- a/src/engine/SCons/Tool/swig.xml +++ b/src/engine/SCons/Tool/swig.xml @@ -22,13 +22,13 @@ The suffix that will be used for intermediate C 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> @@ -44,7 +44,7 @@ the scripting language wrapper and interface generator. <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> @@ -54,11 +54,11 @@ The suffix that will be used for intermediate C++ 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> @@ -79,7 +79,7 @@ option in this variable, 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> diff --git a/src/engine/SCons/Tool/tar.xml b/src/engine/SCons/Tool/tar.xml index 88265dc..763df54 100644 --- a/src/engine/SCons/Tool/tar.xml +++ b/src/engine/SCons/Tool/tar.xml @@ -65,7 +65,7 @@ The command line used to call the tar archiver. <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") diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 1defd90..0e3d4b1 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -52,6 +52,10 @@ undefined_references_re = re.compile(undefined_references_str, re.MULTILINE) 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 @@ -72,6 +76,24 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=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) @@ -96,21 +118,26 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None 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): @@ -153,25 +180,30 @@ def tex_emitter(target, source, env): 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) diff --git a/src/engine/SCons/Tool/tex.xml b/src/engine/SCons/Tool/tex.xml index b30b36d..4cfc252 100644 --- a/src/engine/SCons/Tool/tex.xml +++ b/src/engine/SCons/Tool/tex.xml @@ -29,7 +29,7 @@ typesetter. <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") @@ -64,7 +64,7 @@ typesetter. 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> @@ -91,7 +91,7 @@ The command line used to call the TeX formatter and typesetter. <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") diff --git a/src/engine/SCons/Tool/yacc.xml b/src/engine/SCons/Tool/yacc.xml index 8a23d0b..a6ad9b4 100644 --- a/src/engine/SCons/Tool/yacc.xml +++ b/src/engine/SCons/Tool/yacc.xml @@ -27,7 +27,7 @@ to generate a source file. <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") @@ -38,7 +38,7 @@ 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 diff --git a/src/engine/SCons/Tool/zip.xml b/src/engine/SCons/Tool/zip.xml index 5e28bee..909a4c4 100644 --- a/src/engine/SCons/Tool/zip.xml +++ b/src/engine/SCons/Tool/zip.xml @@ -58,7 +58,7 @@ zip archive. <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> diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index eb38e44..f1e856b 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -367,6 +367,12 @@ def is_List(obj): 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 diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py index 7b74ab4..959bf52 100644 --- a/src/engine/SCons/compat/__init__.py +++ b/src/engine/SCons/compat/__init__.py @@ -55,10 +55,10 @@ other uses. (That said, making these more nearly the same as later, 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. @@ -86,14 +86,14 @@ except NameError: 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 @@ -102,10 +102,10 @@ try: 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') diff --git a/src/engine/SCons/compat/_UserString.py b/src/engine/SCons/compat/_scons_UserString.py index 4adffa2..4adffa2 100644 --- a/src/engine/SCons/compat/_UserString.py +++ b/src/engine/SCons/compat/_scons_UserString.py diff --git a/src/engine/SCons/compat/_sets.py b/src/engine/SCons/compat/_scons_sets.py index 32a0dd6..32a0dd6 100644 --- a/src/engine/SCons/compat/_sets.py +++ b/src/engine/SCons/compat/_scons_sets.py diff --git a/src/engine/SCons/compat/_sets15.py b/src/engine/SCons/compat/_scons_sets15.py index b3d0bb3..b3d0bb3 100644 --- a/src/engine/SCons/compat/_sets15.py +++ b/src/engine/SCons/compat/_scons_sets15.py diff --git a/src/engine/SCons/compat/_subprocess.py b/src/engine/SCons/compat/_scons_subprocess.py index fc06347..df7e702 100644 --- a/src/engine/SCons/compat/_subprocess.py +++ b/src/engine/SCons/compat/_scons_subprocess.py @@ -1049,8 +1049,20 @@ class Popen(object): # 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: |