This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aaron-whitehouse
Recipients Jim Nasby, aaron-whitehouse, josh.r
Date 2017-02-26.18:20:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488133235.82.0.840528272019.issue28718@psf.upfronthosting.co.za>
In-reply-to
Content
Note that somebody has forked the standard library to implement this:
https://github.com/kianxineki/python-wildcard
This shows that the actual changes would be pretty small (though pywildcard is based on 2.x code and does not handle the cross-platform slashes you have been discussing).

It is also worth noting that the glob standard library:
https://docs.python.org/3.7/library/glob.html
implements a "recursive" option that has similar behaviour (* does not span path separators whereas ** does) and essentially builds this on top of fnmatch for the actual filename matching. 

I do not think we can change the default behaviour of fnmatch at this point, but I would like to see this behaviour triggered by an optional argument to the various functions, e.g.:
fnmatch.fnmatch(filename, pattern, glob_asterisks=False)
fnmatch.fnmatchcase(filename, pattern, glob_asterisks=False)
fnmatch.filter(names, pattern, glob_asterisks=False)
fnmatch.translate(pattern, glob_asterisks=False)

In each case, if glob_asterisks (or whatever other name we came up with) is true, the behaviour would match the pywildcard behaviour, i.e.:
    **      matches everything
    *       matches in one path level

I look after the glob matching code in duplicity and would like to start using the standard library to do filename matching for us, but we need the above behaviour. I am happy to do the patching if there is a realistic chance of it being accepted.
History
Date User Action Args
2017-02-26 18:20:35aaron-whitehousesetrecipients: + aaron-whitehouse, josh.r, Jim Nasby
2017-02-26 18:20:35aaron-whitehousesetmessageid: <1488133235.82.0.840528272019.issue28718@psf.upfronthosting.co.za>
2017-02-26 18:20:35aaron-whitehouselinkissue28718 messages
2017-02-26 18:20:35aaron-whitehousecreate