Skip to content

Commit 2e77f02

Browse files
authored
removing Trailing windows generated \r i
Removing Trailing windows generated \r
1 parent 2403b0c commit 2e77f02

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

liccheck/command_line.py

Lines changed: 10 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,13 @@ 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+
search_string = ".*\r$"
156+
if re.search(search_string, license):
157+
return license[:-2]
158+
return license
159+
151160
def strip_license(license):
152161
if license.lower().endswith(" license"):
153162
return license[:-len(" license")]

0 commit comments

Comments
 (0)