mirror of
https://github.com/vale981/melpazoid
synced 2025-03-06 01:41:38 -05:00
make LICENSE file detection a bit more accurate
This commit is contained in:
parent
b796c0bcab
commit
a89df39d6d
1 changed files with 5 additions and 5 deletions
|
@ -374,12 +374,12 @@ def repo_info_github(clone_address: str) -> Dict[str, Any]:
|
|||
def _check_license_file(elisp_dir: str) -> bool:
|
||||
"""Scan any COPYING or LICENSE files."""
|
||||
for license_ in glob.glob(os.path.join(elisp_dir, '*')):
|
||||
license_ = os.path.basename(license_)
|
||||
if re.match('LICENSE|COPYING|UNLICENSE', license_, flags=re.I):
|
||||
with open(os.path.join(elisp_dir, license_), errors='replace') as stream:
|
||||
print(f"- {license_} excerpt: `{stream.readline().strip()}...`")
|
||||
license_basename = os.path.basename(license_)
|
||||
if license_basename.upper() in ('LICENSE', 'COPYING', 'UNLICENSE'):
|
||||
with open(license_, encoding='utf-8', errors='replace') as stream:
|
||||
print(f"- {license_basename} excerpt: `{stream.readline().strip()}...`")
|
||||
return True
|
||||
_fail('- Add a LICENSE (or COPYING) file to the repository')
|
||||
_fail('- Add a LICENSE file to the repository')
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue