Report files in original (filesystem) case

This commit is contained in:
Paul Moore 2018-07-23 13:11:57 +01:00
parent a2968978c9
commit ab0644479f
2 changed files with 8 additions and 5 deletions

View File

@ -120,6 +120,8 @@ def compress_for_output_listing(paths):
folders.add(os.path.dirname(path))
files.add(path)
_normcased_files = set(map(os.path.normcase, files))
folders = compact(folders)
# This walks the tree using os.walk to not miss extra folders
@ -130,8 +132,9 @@ def compress_for_output_listing(paths):
if fname.endswith(".pyc"):
continue
file_ = os.path.normcase(os.path.join(dirpath, fname))
if os.path.isfile(file_) and file_ not in files:
file_ = os.path.join(dirpath, fname)
if (os.path.isfile(file_) and
os.path.normcase(file_) not in _normcased_files):
# We are skipping this file. Add it to the set.
will_skip.add(file_)

View File

@ -50,9 +50,9 @@ def test_compressed_listing(tmpdir):
def in_tmpdir(paths):
li = []
for path in paths:
li.append(str(os.path.normcase(
os.path.join(tmpdir, path.replace("/", os.path.sep))
)))
li.append(
str(os.path.join(tmpdir, path.replace("/", os.path.sep)))
)
return li
sample = in_tmpdir([