From a8234e39337ff91cde2d243b4ba6563552e47385 Mon Sep 17 00:00:00 2001 From: Chin Yeung Li Date: Wed, 2 Jul 2014 12:05:24 -0700 Subject: [PATCH] Fixed #114 The problem is the tool trying to find the license in a different location. --- about_code_tool/genabout.py | 8 ++++---- about_code_tool/tests/test_genabout.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/about_code_tool/genabout.py b/about_code_tool/genabout.py index df5c4ffa..96e67479 100644 --- a/about_code_tool/genabout.py +++ b/about_code_tool/genabout.py @@ -23,7 +23,7 @@ from collections import namedtuple from os import makedirs -from os.path import exists, dirname, join, abspath, isdir +from os.path import exists, dirname, join, abspath, isdir, normpath import about @@ -317,10 +317,10 @@ def get_dje_license_list(self, gen_location, input_list, gen_license, dje_licens # update/overwrite the 'license_text_file' with 'dje_license_key' if line['license_text_file']: file_location = line['about_file'] - if file_location.endswith('/'): - file_location = file_location.rpartition('/')[0] + #if file_location.endswith('/'): + # file_location = file_location.rpartition('/')[0] about_parent_dir = dirname(file_location) - license_file = gen_location.rpartition('/')[0] + join(about_parent_dir, line['license_text_file']) + license_file = normpath(gen_location.rpartition('/')[0] + join(about_parent_dir, line['license_text_file'])) if not _exists(license_file): self.errors.append(Error('license_text_file', license_file, "The 'license_text_file' does not exist.")) else: diff --git a/about_code_tool/tests/test_genabout.py b/about_code_tool/tests/test_genabout.py index d2b4585e..a6379ec4 100644 --- a/about_code_tool/tests/test_genabout.py +++ b/about_code_tool/tests/test_genabout.py @@ -218,7 +218,7 @@ def test_get_dje_license_list_dir_no_gen_license_with_license_text_file_key_exis gen_location = join(TESTDATA_PATH, "test_files_for_genabout/") input_list = [{'about_file': '/ABOUT/', 'version': '0.8.1', 'about_resource': '.', 'name': 'ABOUT tool', - 'license_text_file': '../../../../apache2.LICENSE'}] + 'license_text_file': '../../../../../apache2.LICENSE'}] expected_output_list = [] gen_license = False dje_license_dict = {}