Skip to content

Commit df080f3

Browse files
committed
Fixed #109
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.
1 parent 2f3d0db commit df080f3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

about_code_tool/genabout.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,11 @@ def pre_generation(self, gen_location, input_list, action_num, all_in_one):
388388
file_location = file_location.partition('/')[2]
389389
if not file_location.endswith('.ABOUT'):
390390
if file_location.endswith('/'):
391-
file_location = file_location.rpartition('/')[0]
391+
file_location = dirname(file_location)
392+
file_location = join(file_location, os.path.basename(file_location))
393+
# Since this is referencing everything in the current directory,
394+
# we will use a '.' period to reference it.
395+
line['about_resource'] = '.'
392396
file_location += '.ABOUT'
393397
if all_in_one:
394398
# This is to get the filename instead of the file path

about_code_tool/tests/test_genabout.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def test_get_mapping_list(self):
6363
gen = genabout.GenAbout()
6464
expected_list = {'about_file': 'directory/filename',
6565
'version': 'confirmed version',
66-
'about_resource': 'file_name', 'name': 'component'}
66+
'about_resource': 'file_name',
67+
'name': 'component',
68+
'copyright': 'confirmed copyright'}
6769
output = gen.get_mapping_list()
6870
self.assertTrue(output == expected_list)
6971

@@ -295,11 +297,11 @@ def test_pre_generation_about_is_dir_exists_action_0(self):
295297
action_num = 0
296298
input_list = [{'about_file': '/TESTCASE/', 'version': '0.8.1',
297299
'about_resource': '.', 'name': 'ABOUT tool'}]
298-
expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/TESTCASE.ABOUT'),
300+
expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/TESTCASE', 'TESTCASE.ABOUT'),
299301
{'about_file': '/TESTCASE/', 'version': '0.8.1',
300302
'about_resource': '.', 'name': 'ABOUT tool'}]]
301303
output_list = gen.pre_generation(gen_location, input_list, action_num, False)
302-
self.assertTrue(expected_output_list == output_list, "This output_list should be empty.")
304+
self.assertTrue(expected_output_list == output_list)
303305
self.assertFalse(gen.warnings, "No warnings should be returned.")
304306
self.assertFalse(gen.errors, "No errors should be returned.")
305307

0 commit comments

Comments
 (0)