Skip to content

Commit d65f89a

Browse files
author
Olivier Chédru
authored
Merge pull request #79 from neuroforgede/master
Fix \r issues on Windows
2 parents 2403b0c + deb0c19 commit d65f89a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

liccheck/command_line.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ def transform(dist):
119119
licenses = get_licenses_from_classifiers(dist) or get_license(dist) or []
120120
# Strip the useless "License" suffix and uniquify
121121
licenses = list(set([strip_license(l) for l in licenses]))
122+
# Removing Trailing windows generated \r
123+
licenses = list(set([strip_license_for_windows(l) for l in licenses]))
124+
122125
return {
123126
'name': dist.project_name,
124127
'version': dist.version,
@@ -147,7 +150,12 @@ def get_licenses_from_classifiers(dist):
147150
return [m for m in regex_classifier.findall(metadata) if m]
148151

149152
return []
150-
153+
154+
def strip_license_for_windows(license):
155+
if license.endswith("\r"):
156+
return license[:-1]
157+
return license
158+
151159
def strip_license(license):
152160
if license.lower().endswith(" license"):
153161
return license[:-len(" license")]

0 commit comments

Comments
 (0)