classification
Title: Distutils manifest: recursive-(include|exclude) matches suffix instead of full filename
Type: behavior Stage: resolved
Components: Distutils, Distutils2 Versions: Python 3.2, Python 3.3, Python 2.7, 3rd party
process
Status: closed Resolution: out of date
Dependencies: 6884 Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, mgedmin, nadeem.vawda, steve.dower, tarek
Priority: normal Keywords: patch

Created on 2012-02-24 14:46 by nadeem.vawda, last changed 2021-02-03 18:07 by steve.dower. This issue is now closed.

Files
File name Uploaded Description Edit
recursive-include.diff nadeem.vawda, 2012-02-24 14:46
Messages (4)
msg154137 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2012-02-24 14:46
As I understand it, a MANIFEST.in directive:

    recursive-include foo bar.*

is meant to match files under foo for with names beginning with "bar.".
However, the actual regex that is generated for this line is:

    r'^foo/.*bar\.[^/]*\Z(?ms)'

which matches any filename under foo that contains "bar." anywhere in the
base filename. For example, if foo contains files bar.py and test_bar.py,
then the pattern will match both filenames. Is this the intended
behaviour? I would have expected it to only match bar.py.

If the desired behavior is what I expected (and not how it currently
works), then the desired regex is:

    r'^foo/(.*/)?bar\.[^/]*\Z(?ms)'

The attached patch (against 2.7) implements this change. It is dependent
on the fix for issue 6884. I have tested it on both Linux and Windows.
msg154187 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2012-02-25 05:45
Thanks, will look into it.
msg367971 - (view) Author: Marius Gedminas (mgedmin) * Date: 2020-05-03 14:00
For the record, this is still a bug in Python 3.8 distutils (and it affects global-(include|exclude) as well), but it's been fixed in setuptools, so it shouldn't affect people writing MANIFEST.in files in 2020.
msg386266 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:07
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:07:59steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386266

resolution: out of date
stage: patch review -> resolved
2020-05-03 14:00:22mgedminsetnosy: + mgedmin
messages: + msg367971
2012-02-25 05:45:21eric.araujosetversions: + 3rd party
nosy: + alexis

messages: + msg154187

assignee: eric.araujo
components: + Distutils, Distutils2
2012-02-24 14:47:24nadeem.vawdasetdependencies: + Impossible to include file in sdist that starts with 'build' on Win32
stage: needs patch -> patch review
2012-02-24 14:46:34nadeem.vawdacreate