Skip to content

Commit d74d8e4

Browse files
committed
Fix code to get the license location correctly.
1 parent df080f3 commit d74d8e4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

about_code_tool/genabout.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ def verify_license_files(self, input_list, project_dir, license_in_project):
208208
file_location = line['about_file']
209209
if file_location.startswith('/'):
210210
file_location = file_location.partition('/')[2]
211-
if file_location.endswith('/'):
212-
file_location = file_location.rpartition('/')[0]
211+
#if file_location.endswith('/'):
212+
# file_location = file_location.rpartition('/')[0]
213213
about_parent_dir = dirname(file_location)
214214
if license_in_project:
215215
license_file_path = join(project_dir, about_parent_dir, license_file)
@@ -661,8 +661,8 @@ def main(parser, options, args):
661661
print("The '--copy_license' <project_path> must be a directory.")
662662
print("'--copy_license' is skipped.")
663663
else:
664-
if not copy_license_path.endswith('/'):
665-
copy_license_path += '/'
664+
#if not copy_license_path.endswith('/'):
665+
# copy_license_path += '/'
666666
project_parent_dir = dirname(copy_license_path)
667667
licenses_in_project = True
668668
license_list = gen.verify_license_files(input_list, project_parent_dir, licenses_in_project)
@@ -676,8 +676,8 @@ def main(parser, options, args):
676676
print("The '--license_text_location' <license_path> must be a directory.")
677677
print("'--license_text_location' is skipped.")
678678
else:
679-
if not license_text_path.endswith('/'):
680-
license_text_path += '/'
679+
#if not license_text_path.endswith('/'):
680+
# license_text_path += '/'
681681
license_dir = dirname(license_text_path)
682682
licenses_in_project = False
683683
license_list = gen.verify_license_files(input_list, license_dir, licenses_in_project)

about_code_tool/tests/test_genabout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,15 @@ def test_verify_license_files_exist(self):
407407
'license_text_file': 'apache2.LICENSE',
408408
'name': 'ABOUT tool', 'about_resource': '.'}]
409409
path = '.'
410-
expected_list = [(join('.', 'apache2.LICENSE'), '')]
410+
expected_list = [(join('.', 'apache2.LICENSE'), 'TESTCASE')]
411411
output = gen.verify_license_files(input_list, path, False)
412412
self.assertEqual(expected_list, output)
413413
self.assertFalse(gen.warnings, "No warnings should be returned.")
414414
self.assertFalse(gen.errors, "No errors should be returned.")
415415

416416
def test_verify_license_files_exist_license_in_project(self):
417417
gen = genabout.GenAbout()
418-
input_list = [{'version': '0.8.1', 'about_file': '/TESTCASE/',
418+
input_list = [{'version': '0.8.1', 'about_file': '.',
419419
'license_text_file': 'apache2.LICENSE',
420420
'name': 'ABOUT tool', 'about_resource': '.'}]
421421
path = '.'

0 commit comments

Comments
 (0)