diff options
author | Steven Knight <knight@baldmt.com> | 2006-01-21 12:04:15 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-01-21 12:04:15 (GMT) |
commit | fcbe6204ad17af3c5b5fd138de734a45399cb839 (patch) | |
tree | 0b735d528b9b3eb82b4d6170e6ea89cf5f1e15cd /src/engine/SCons/Node | |
parent | 8029f3079db3fcd71d4fc10e3d6cc28987349b56 (diff) | |
download | SCons-fcbe6204ad17af3c5b5fd138de734a45399cb839.zip SCons-fcbe6204ad17af3c5b5fd138de734a45399cb839.tar.gz SCons-fcbe6204ad17af3c5b5fd138de734a45399cb839.tar.bz2 |
Deprecate $WIN32 variables name in place of $WINDOWS* variables names, and eliminate other Win32 references.
Diffstat (limited to 'src/engine/SCons/Node')
-rw-r--r-- | src/engine/SCons/Node/FS.py | 17 | ||||
-rw-r--r-- | src/engine/SCons/Node/FSTests.py | 22 |
2 files changed, 26 insertions, 13 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 69936d2..d9282ea 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -405,7 +405,7 @@ class EntryProxy(SCons.Util.Proxy): r = string.replace(entry.get_path(), os.sep, '/') return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_posix") - def __get_win32_path(self): + def __get_windows_path(self): """Return the path with \ as the path separator, regardless of platform.""" if os.sep == '\\': @@ -413,7 +413,7 @@ class EntryProxy(SCons.Util.Proxy): else: entry = self.get() r = string.replace(entry.get_path(), os.sep, '\\') - return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_win32") + return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_windows") def __get_srcnode(self): return EntryProxy(self.get().srcnode()) @@ -436,7 +436,8 @@ class EntryProxy(SCons.Util.Proxy): dictSpecialAttrs = { "base" : __get_base_path, "posix" : __get_posix_path, - "win32" : __get_win32_path, + "windows" : __get_windows_path, + "win32" : __get_windows_path, "srcpath" : __get_srcnode, "srcdir" : __get_srcdir, "dir" : __get_dir, @@ -452,7 +453,7 @@ class EntryProxy(SCons.Util.Proxy): # This is how we implement the "special" attributes # such as base, posix, srcdir, etc. try: - return self.dictSpecialAttrs[name](self) + attr_function = self.dictSpecialAttrs[name] except KeyError: try: attr = SCons.Util.Proxy.__getattr__(self, name) @@ -467,6 +468,8 @@ class EntryProxy(SCons.Util.Proxy): classname = classname[:-2] raise AttributeError, "%s instance '%s' has no attribute '%s'" % (classname, entry.name, name) return attr + else: + return attr_function(self) class Base(SCons.Node.Node): """A generic class for file system entries. This class is for @@ -907,12 +910,12 @@ class FS(LocalFS): __cacheable__""" if not name: - # This is a stupid hack to compensate for the fact that - # the POSIX and Win32 versions of os.path.normpath() behave + # This is a stupid hack to compensate for the fact that the + # POSIX and Windows versions of os.path.normpath() behave # differently in older versions of Python. In particular, # in POSIX: # os.path.normpath('./') == '.' - # in Win32 + # in Windows: # os.path.normpath('./') == '' # os.path.normpath('.\\') == '' # diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 8c95f87..96fa490 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -960,14 +960,14 @@ class FSTestCase(_tempdirTestCase): p = os.path.abspath(test.workpath('root_file')) drive, path = os.path.splitdrive(p) if drive: - # The assert below probably isn't correct for the - # general case, but it works for Win32, which covers a - # lot of ground... + # The assert below probably isn't correct for the general + # case, but it works for Windows, which covers a lot + # of ground... dir = fs.Dir(drive) assert str(dir) == drive + os.sep, str(dir) # Test for a bug in 0.04 that did not like looking up - # dirs with a trailing slash on Win32. + # dirs with a trailing slash on Windows. d=fs.Dir('./') assert d.path == '.', d.abspath d=fs.Dir('foo/') @@ -1132,7 +1132,7 @@ class FSTestCase(_tempdirTestCase): f1.built() assert not f1.exists() - # For some reason, in Win32, the \x1a character terminates + # For some reason, in Windows, the \x1a character terminates # the reading of files in text mode. This tests that # get_contents() returns the binary contents. test.write("binary_file", "Foo\x1aBar") @@ -2800,12 +2800,20 @@ class SpecialAttrTestCase(unittest.TestCase): for_sig = f.posix.for_signature() assert for_sig == 'baz.blat_posix', for_sig + s = str(f.windows) + assert s == 'foo\\bar\\baz.blat', repr(s) + assert f.windows.is_literal(), f.windows + if f.windows != f: + for_sig = f.windows.for_signature() + assert for_sig == 'baz.blat_windows', for_sig + + # Deprecated synonym for the .windows suffix. s = str(f.win32) assert s == 'foo\\bar\\baz.blat', repr(s) assert f.win32.is_literal(), f.win32 if f.win32 != f: for_sig = f.win32.for_signature() - assert for_sig == 'baz.blat_win32', for_sig + assert for_sig == 'baz.blat_windows', for_sig # And now, combinations!!! s = str(f.srcpath.base) @@ -2814,6 +2822,8 @@ class SpecialAttrTestCase(unittest.TestCase): assert s == str(f.srcdir), s s = str(f.srcpath.posix) assert s == 'foo/bar/baz.blat', s + s = str(f.srcpath.windows) + assert s == 'foo\\bar\\baz.blat', s s = str(f.srcpath.win32) assert s == 'foo\\bar\\baz.blat', s |