summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2009-05-29 01:41:22 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2009-05-29 01:41:22 (GMT)
commit59efed12aebfcefcbcab1793e57d7b51552d7c2e (patch)
treea4fb551ec96edbf470efa612dcceeb9f2213695c
parente37968dcdb65b228ec5bf0f738ca9121dd9282f2 (diff)
downloadSCons-59efed12aebfcefcbcab1793e57d7b51552d7c2e.zip
SCons-59efed12aebfcefcbcab1793e57d7b51552d7c2e.tar.gz
SCons-59efed12aebfcefcbcab1793e57d7b51552d7c2e.tar.bz2
Fix issue #2419 by sorting the other return path from glob() in FS.py. Thanks to Jin Liu for the original analysis of the problem.
-rw-r--r--src/engine/SCons/Node/FS.py4
-rw-r--r--src/engine/SCons/Node/FSTests.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index c34cfed..9fdac79 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -1953,7 +1953,9 @@ class Dir(Base):
"""
dirname, basename = os.path.split(pathname)
if not dirname:
- return self._glob1(basename, ondisk, source, strings)
+ result = self._glob1(basename, ondisk, source, strings)
+ result.sort(lambda a, b: cmp(str(a), str(b)))
+ return result
if has_glob_magic(dirname):
list = self.glob(dirname, ondisk, source, strings=False)
else:
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index cb2bd68..9582a97 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -2179,8 +2179,8 @@ class GlobTestCase(_tempdirTestCase):
# Make entries on disk that will not have Nodes, so we can verify
# the behavior of looking for things on disk.
- self.test.write('disk-aaa', "disk-aaa\n")
self.test.write('disk-bbb', "disk-bbb\n")
+ self.test.write('disk-aaa', "disk-aaa\n")
self.test.write('disk-ccc', "disk-ccc\n")
self.test.write('#disk-hash', "#disk-hash\n")
self.test.subdir('disk-sub')
@@ -2489,6 +2489,8 @@ class GlobTestCase(_tempdirTestCase):
join = os.path.join
# At least sometimes this should return out-of-order items
# if Glob doesn't sort.
+ # It's not a very good test though since it depends on the
+ # order returned by glob, which might already be sorted.
g = self.fs.Glob('disk-sub/*', strings=True)
expect = [
os.path.join('disk-sub', 'disk-ddd'),
@@ -2497,6 +2499,10 @@ class GlobTestCase(_tempdirTestCase):
]
assert g == expect, str(g) + " is not sorted, but should be!"
+ g = self.fs.Glob('disk-*', strings=True)
+ expect = [ 'disk-aaa', 'disk-bbb', 'disk-ccc', 'disk-sub' ]
+ assert g == expect, str(g) + " is not sorted, but should be!"
+
class RepositoryTestCase(_tempdirTestCase):