Skip to content

Commit

Permalink
Extended conditions for finding package license files
Browse files Browse the repository at this point in the history
Find a match for LICENSE* / COPYING*
Fix #59
  • Loading branch information
raimon49 committed Jan 28, 2020
1 parent ac191c3 commit 4e2c5a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ def get_pkg_license_file(pkg):
license_text = LICENSE_UNKNOWN
pkg_dirname = "{}-{}.dist-info".format(
pkg.project_name.replace("-", "_"), pkg.version)
license_file_base = os.path.join(pkg.location, pkg_dirname, 'LICENSE*')
for test_file in glob.glob(license_file_base):
file_names = ('LICENSE*', 'COPYING*')
patterns = []
[patterns.extend(glob.glob(os.path.join(pkg.location,
pkg_dirname,
f))) for f in file_names]
for test_file in patterns:
if os.path.exists(test_file):
license_file = test_file
with open(test_file, encoding='utf-8') as license_file_handle:
Expand Down

0 comments on commit 4e2c5a9

Please sign in to comment.