From ca3b3b6092c0954a40b2c9df0f69b51b465b0ba9 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 20 Sep 2004 20:25:31 +0000 Subject: [PATCH] Fix handling when BuildDir exists but is unwriteable. Add Stop. to messages at SConscript-read time. (Kevin Quick) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1089 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 3 +++ src/engine/SCons/Node/FS.py | 2 +- src/engine/SCons/Script/__init__.py | 4 ++-- test/BuildDir-errors.py | 14 ++++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 3fc014f3..000c9438 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -123,6 +123,9 @@ RELEASE 0.97 - XXX function, use its strfunction() method (if any) to display the action. + - Fix handling when BuildDir() exists but is unwriteable. Add + "Stop." to those error messages for consistency. + From Christoph Wiedemann: - Add an Environment.SetDefault() method that only sets values if diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 7f60c7b6..5015c842 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1675,7 +1675,7 @@ class File(Base): try: Link(self, src, None) except SCons.Errors.BuildError, e: - desc = "Cannot duplicate `%s' in `%s': %s." % (src, self.dir, e.errstr) + desc = "Cannot duplicate `%s' in `%s': %s." % (src.path, self.dir.path, e.errstr) raise SCons.Errors.StopError, desc self.linked = 1 # The Link() action may or may not have actually diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 160fae30..4832b020 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -912,9 +912,9 @@ def _main(args, parser): # couldn't be copied in to the BuildDir. Since we're just # reading SConscript files and haven't started building # things yet, stop regardless of whether they used -i or -k - # or anything else, but don't say "Stop." on the message. + # or anything else. global exit_status - sys.stderr.write("scons: *** %s\n" % e) + sys.stderr.write("scons: *** %s Stop.\n" % e) exit_status = 2 sys.exit(exit_status) global sconscript_time diff --git a/test/BuildDir-errors.py b/test/BuildDir-errors.py index 967384cd..93cd3ece 100644 --- a/test/BuildDir-errors.py +++ b/test/BuildDir-errors.py @@ -66,6 +66,12 @@ def cat(env, source, target): env = Environment(BUILDERS={'Build':Builder(action=cat)}, SCANNERS=[Scanner(fake_scan, skeys = ['.in'])]) + +# Do some Node test operations to ensure no side-effects cause failures +File('file.in').exists() +File('file.in').is_derived() +File('file.in').is_pseudo_derived() + env.Build('file.out', 'file.in') """) @@ -87,7 +93,7 @@ if sys.platform != 'win32': test.run(chdir = 'ro-dir', arguments = ".", status = 2, - stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied.\n" % os.path.join('src', 'SConscript')) + stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) # Verify the error when the SConscript file within the BuildDir is # read-only. Note that we have to make the directory read-only too, @@ -104,7 +110,7 @@ os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR) test.run(chdir = 'ro-SConscript', arguments = ".", status = 2, - stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied.\n" % os.path.join('src', 'SConscript')) + stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) os.chmod('ro-SConscript', os.stat('ro-SConscript')[stat.ST_MODE] | stat.S_IWUSR) f.close() @@ -112,7 +118,7 @@ f.close() test.run(chdir = 'ro-SConscript', arguments = ".", status = 2, - stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied.\n" % os.path.join('src', 'SConscript')) + stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript')) # Verify the error when the source file within the BuildDir is # read-only. Note that we have to make the directory read-only too, @@ -140,7 +146,7 @@ test.run(chdir = 'ro-src', arguments = "-k .", status = 2, stderr = """\ -scons: *** Cannot duplicate `%s' in `build': Permission denied. +scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop. """ % (os.path.join('src', 'file.in'))) f.close() -- 2.26.2