(pkg_dir)
| 41 | |
| 42 | |
| 43 | def license_text(pkg_dir): |
| 44 | if not os.path.isdir(pkg_dir): |
| 45 | return None |
| 46 | for fname in sorted(os.listdir(pkg_dir)): |
| 47 | if fname.upper().startswith(("LICENSE", "LICENCE", "COPYING", "NOTICE")): |
| 48 | try: |
| 49 | with open(os.path.join(pkg_dir, fname), encoding="utf-8", errors="replace") as fh: |
| 50 | return fh.read().strip() |
| 51 | except OSError: |
| 52 | continue |
| 53 | return None |
| 54 | |
| 55 | |
| 56 | def declared_license(pkg_dir): |