Skip to content

Commit

Permalink
Merge pull request #550 from layday/recursive-globbing
Browse files Browse the repository at this point in the history
Add support for recursive `**` includes and excludes
  • Loading branch information
takluyver committed Jul 16, 2022
2 parents 3edbd2f + d66073a commit ad38f36
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
5 changes: 5 additions & 0 deletions doc/history.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release history
===============

Unreleased
----------

- Add support for recursive globbing (``**``) in sdist includes and excludes (:ghpull:`550`).

Version 3.7.1
-------------

Expand Down
5 changes: 0 additions & 5 deletions flit_core/flit_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,6 @@ def _check_glob_patterns(pats, clude):
'{} pattern {!r} contains bad characters (<>:\"\\ or control characters)'
.format(clude, p)
)
if '**' in p:
raise ConfigError(
"Recursive globbing (**) is not supported yet (in {} pattern {!r})"
.format(clude, p)
)

normp = osp.normpath(p)

Expand Down
2 changes: 1 addition & 1 deletion flit_core/flit_core/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, patterns, basedir):
self.files = set()

for pattern in patterns:
for path in sorted(glob(osp.join(basedir, pattern))):
for path in sorted(glob(osp.join(basedir, pattern), recursive=True)):
rel = osp.relpath(path, basedir)
if osp.isdir(path):
self.dirs.add(rel)
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion flit_core/flit_core/tests/samples/inclusion/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ author-email = "robin@camelot.uk"

[tool.flit.sdist]
include = ["doc"]
exclude = ["doc/*.txt"]
exclude = ["doc/*.txt", "doc/**/*.md"]
1 change: 0 additions & 1 deletion flit_core/flit_core/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def test_faulty_requires_extra(erroneous, match):
('foo/../../bar', 'out of the directory'),
('/home', 'absolute path'),
('foo:bar', 'bad character'),
('foo/**/bar', '[Rr]ecursive glob')
])
def test_bad_include_paths(path, err_match):
toml_cfg = {'tool': {'flit': {
Expand Down
1 change: 1 addition & 0 deletions flit_core/flit_core/tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_include_exclude():
assert osp.join('doc', 'test.rst') in files
assert osp.join('doc', 'test.txt') not in files
assert osp.join('doc', 'subdir', 'test.txt') in files
assert osp.join('doc', 'subdir', 'subsubdir', 'test.md') not in files


def test_data_dir():
Expand Down

0 comments on commit ad38f36

Please sign in to comment.