Files autodetection fixes

Do not include subdirectories as %doc. Fix #136.
Sort license and doc files alphabetically. Fix #135.
Only include doc files from the root directory. Fix #134.
This commit is contained in:
Robert-André Mauchin 2021-07-14 19:52:16 +02:00
parent f0b940205c
commit b284d61ee7

View file

@ -211,12 +211,11 @@ def get_license_files(path):
for root, dirs, files in os.walk(path, topdown=True):
dirs[:] = [d for d in dirs if d not in exclude]
license_files.extend([os.path.relpath(os.path.join(root, f), path) for f in files if LICENSES.match(f)])
license_files.sort()
return license_files
def get_doc_files(path):
doc_files = []
include = {"doc", "docs", "example", "examples", "_example", "_examples"}
exclude = {"vendor", ".github", "tests", "test", ".circleci"}
matcher = re.compile(
r"(.*\.md|.*\.markdown|.*\.mdown|.*\.mkdn|.*\.rst|.*\.txt|AUTHORS|"
r"AUTHORS[\.\-].*|CONTRIBUTORS|CONTRIBUTORS[\.\-].*|README|"
@ -224,9 +223,9 @@ def get_doc_files(path):
re.IGNORECASE)
matcherex = re.compile(r"CMakeLists\.txt")
for root, dirs, files in os.walk(path, topdown=True):
doc_files = doc_files + [d for d in dirs if d in include]
dirs[:] = [d for d in dirs if d not in exclude]
dirs[:] = []
doc_files.extend([os.path.relpath(os.path.join(root, f), path) for f in files if matcher.match(f) and not LICENSES.match(f) and not matcherex.match(f)])
doc_files.sort()
return doc_files
def make_diff_metadata(crate, version, patch=False, store=False):