Skip to content

Commit

Permalink
Fixed #109
Browse files Browse the repository at this point in the history
Put the ABOUT file INSIDE of a directory if this ABOUT file reference the directory and update the 'about_resource' to '.' (period) as a meaning that this ABOUT file is referencing everything in the current directory.
  • Loading branch information
chinyeungli committed Jul 1, 2014
1 parent 2f3d0db commit df080f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion about_code_tool/genabout.py
Expand Up @@ -388,7 +388,11 @@ def pre_generation(self, gen_location, input_list, action_num, all_in_one):
file_location = file_location.partition('/')[2]
if not file_location.endswith('.ABOUT'):
if file_location.endswith('/'):
file_location = file_location.rpartition('/')[0]
file_location = dirname(file_location)
file_location = join(file_location, os.path.basename(file_location))
# Since this is referencing everything in the current directory,
# we will use a '.' period to reference it.
line['about_resource'] = '.'
file_location += '.ABOUT'
if all_in_one:
# This is to get the filename instead of the file path
Expand Down
8 changes: 5 additions & 3 deletions about_code_tool/tests/test_genabout.py
Expand Up @@ -63,7 +63,9 @@ def test_get_mapping_list(self):
gen = genabout.GenAbout()
expected_list = {'about_file': 'directory/filename',
'version': 'confirmed version',
'about_resource': 'file_name', 'name': 'component'}
'about_resource': 'file_name',
'name': 'component',
'copyright': 'confirmed copyright'}
output = gen.get_mapping_list()
self.assertTrue(output == expected_list)

Expand Down Expand Up @@ -295,11 +297,11 @@ def test_pre_generation_about_is_dir_exists_action_0(self):
action_num = 0
input_list = [{'about_file': '/TESTCASE/', 'version': '0.8.1',
'about_resource': '.', 'name': 'ABOUT tool'}]
expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/TESTCASE.ABOUT'),
expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/TESTCASE', 'TESTCASE.ABOUT'),
{'about_file': '/TESTCASE/', 'version': '0.8.1',
'about_resource': '.', 'name': 'ABOUT tool'}]]
output_list = gen.pre_generation(gen_location, input_list, action_num, False)
self.assertTrue(expected_output_list == output_list, "This output_list should be empty.")
self.assertTrue(expected_output_list == output_list)
self.assertFalse(gen.warnings, "No warnings should be returned.")
self.assertFalse(gen.errors, "No errors should be returned.")

Expand Down

0 comments on commit df080f3

Please sign in to comment.