Rewrite the IgnoreList logic to be more distutils-like #114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should eliminate most of the inconsistencies with how distutils treats MANIFEST.in files. (Some inconsistencies remain: distutils allows you to add back previously excluded files.)
The way I went about it:
To elaborate on the last point, here are some examples:
Next, I changed IgnoreList to avoid fnmatch and be entirely based on regular expressions, and this time I'm using distutils's own translate_pattern() to produce exactly the same regular expressions that distutils itself will use for matching.
This may introduce some surprising behaviour, like 'global-exclude a*.txt' now matches on suffixes of file names, so it would exclude files named bar.txt! See https://bugs.python.org/issue14106.
Then tests started failing on Python 2.7, but all I get from the
__repr__
is a bunch of opaque<_sre.SRE_Pattern object at 0xdeadbeef>
, which are impossible to debug. Therefore I'm declaring Python 2.7 support officially dropped!check-manifests's own configuration (--ignore or [check-manifest] ignore=) is now treated as a global-exclude statement in MANIFEST.in, which means:
You can ignore directories only by ignoring every file inside it. There's no way currently of specifying that that works for arbitrarily nested trees, but you can try
--ignore=dir/*,dir/*/*,dir/*/*/*
until you get the result you want.This decision is not cast in stone: I may in the future change the handling of --ignore to match files and directories, because there's no reason it has to be distutils-compatible.
Expect regressions on Windows. I'll fix any that I find.
Closes #98, #113.