Skip to content

Commit

Permalink
Merge pull request #16 from mauritsvanrees/maurits-fix-missing-direct…
Browse files Browse the repository at this point in the history
…ories

Normalize the paths of all files, avoiding duplicate misses of directories
  • Loading branch information
mgedmin committed Sep 20, 2013
2 parents 56b432b + 3bdd0c6 commit c3c09a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Changelog
0.15 (unreleased)
-----------------

* No changes yet.
* Normalize the paths of all files, avoiding some duplicate misses of
directories.
[maurits]


0.14 (2013-08-28)
Expand Down
17 changes: 10 additions & 7 deletions check_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class Bazaar(VCS):
def get_versioned_files():
"""List all files versioned in Bazaar in the current directory."""
output = run(['bzr', 'ls', '-VR'])
return strip_slashes(output.splitlines())
return output.splitlines()


class Subversion(VCS):
Expand Down Expand Up @@ -308,12 +308,15 @@ def detect_vcs():
def get_vcs_files():
"""List all files under version control in the current directory."""
vcs = detect_vcs()
return vcs.get_versioned_files()
return normalize_names(vcs.get_versioned_files())


def strip_slashes(names):
"""Svn/Bzr print directory names with trailing slashes. Strip them."""
return [name.rstrip('/') for name in names]
def normalize_names(names):
"""Some VCS print directory names with trailing slashes. Strip them.
Easiest is to normalize the path.
"""
return [os.path.normpath(name) for name in names]


def add_directories(names):
Expand Down Expand Up @@ -463,8 +466,8 @@ def check_manifest(source_tree='.', create=False, update=False,
run([python, 'setup.py', 'sdist', '-d', tempdir])
sdist_filename = get_one_file_in(tempdir)
info_continue(": %s" % os.path.basename(sdist_filename))
sdist_files = sorted(strip_sdist_extras(strip_toplevel_name(
get_archive_file_list(sdist_filename))))
sdist_files = sorted(normalize_names(strip_sdist_extras(
strip_toplevel_name(get_archive_file_list(sdist_filename)))))
info_continue(": %d files and directories" % len(sdist_files))
if source_files == sdist_files:
info("files in version control match files in the sdist")
Expand Down
8 changes: 4 additions & 4 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def test_strip_toplevel_name_no_common_prefix(self):
from check_manifest import strip_toplevel_name, Failure
self.assertRaises(Failure, strip_toplevel_name, ["a/b", "c/d"])

def test_strip_slashes(self):
from check_manifest import strip_slashes
self.assertEqual(strip_slashes(["a", "b/", "c/d", "e/f/"]),
["a", "b", "c/d", "e/f"])
def test_normalize_names(self):
from check_manifest import normalize_names
self.assertEqual(normalize_names(["a", "b/", "c/d", "e/f/", "g/h/../i"]),
["a", "b", "c/d", "e/f", "g/i"])

def test_add_directories(self):
from check_manifest import add_directories
Expand Down

0 comments on commit c3c09a8

Please sign in to comment.