diff options
author | Steven Knight <knight@baldmt.com> | 2002-01-02 19:42:00 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-01-02 19:42:00 (GMT) |
commit | 0baa34102491423d6707a5becf6b687d851cbbff (patch) | |
tree | fc1fde3b46b0ff212da6884554f5ad3de1ee88a6 | |
parent | a63609706a54d139003eb14f34a88389ebbe58cc (diff) | |
download | SCons-0baa34102491423d6707a5becf6b687d851cbbff.zip SCons-0baa34102491423d6707a5becf6b687d851cbbff.tar.gz SCons-0baa34102491423d6707a5becf6b687d851cbbff.tar.bz2 |
Node.FS performance improvements (Charles Crain).
-rw-r--r-- | src/engine/SCons/Node/FS.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 7e9a44b..9da3a88 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -83,15 +83,22 @@ class PathName: convert_path = str def __init__(self, path_name=''): - self.data = PathName.convert_path(path_name) - self.norm_path = os.path.normcase(self.data) + if isinstance(path_name, PathName): + self.__dict__ = path_name.__dict__ + else: + self.data = PathName.convert_path(path_name) + self.norm_path = os.path.normcase(self.data) def __hash__(self): return hash(self.norm_path) def __cmp__(self, other): + if isinstance(other, PathName): + return cmp(self.norm_path, other.norm_path) return cmp(self.norm_path, os.path.normcase(PathName.convert_path(other))) def __rcmp__(self, other): + if isinstance(other, PathName): + return cmp(other.norm_path, self.norm_path) return cmp(os.path.normcase(PathName.convert_path(other)), self.norm_path) def __str__(self): @@ -127,10 +134,11 @@ class PathDict(UserDict): del(self.data[PathName(key)]) def setdefault(self, key, value): + key = PathName(key) try: - return self.data[PathName(key)] + return self.data[key] except KeyError: - self.data[PathName(key)] = value + self.data[key] = value return value class FS: |