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:
parent
f0b940205c
commit
b284d61ee7
1 changed files with 3 additions and 4 deletions
|
@ -211,12 +211,11 @@ def get_license_files(path):
|
||||||
for root, dirs, files in os.walk(path, topdown=True):
|
for root, dirs, files in os.walk(path, topdown=True):
|
||||||
dirs[:] = [d for d in dirs if d not in exclude]
|
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.extend([os.path.relpath(os.path.join(root, f), path) for f in files if LICENSES.match(f)])
|
||||||
|
license_files.sort()
|
||||||
return license_files
|
return license_files
|
||||||
|
|
||||||
def get_doc_files(path):
|
def get_doc_files(path):
|
||||||
doc_files = []
|
doc_files = []
|
||||||
include = {"doc", "docs", "example", "examples", "_example", "_examples"}
|
|
||||||
exclude = {"vendor", ".github", "tests", "test", ".circleci"}
|
|
||||||
matcher = re.compile(
|
matcher = re.compile(
|
||||||
r"(.*\.md|.*\.markdown|.*\.mdown|.*\.mkdn|.*\.rst|.*\.txt|AUTHORS|"
|
r"(.*\.md|.*\.markdown|.*\.mdown|.*\.mkdn|.*\.rst|.*\.txt|AUTHORS|"
|
||||||
r"AUTHORS[\.\-].*|CONTRIBUTORS|CONTRIBUTORS[\.\-].*|README|"
|
r"AUTHORS[\.\-].*|CONTRIBUTORS|CONTRIBUTORS[\.\-].*|README|"
|
||||||
|
@ -224,9 +223,9 @@ def get_doc_files(path):
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
matcherex = re.compile(r"CMakeLists\.txt")
|
matcherex = re.compile(r"CMakeLists\.txt")
|
||||||
for root, dirs, files in os.walk(path, topdown=True):
|
for root, dirs, files in os.walk(path, topdown=True):
|
||||||
doc_files = doc_files + [d for d in dirs if d in include]
|
dirs[:] = []
|
||||||
dirs[:] = [d for d in dirs if d not in exclude]
|
|
||||||
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.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
|
return doc_files
|
||||||
|
|
||||||
def make_diff_metadata(crate, version, patch=False, store=False):
|
def make_diff_metadata(crate, version, patch=False, store=False):
|
||||||
|
|
Loading…
Reference in a new issue