|
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
15 | 15 | # ============================================================================ |
16 | | - |
17 | 16 | """ |
18 | 17 | This is a tool to generate ABOUT files based on the input file. |
19 | 18 | The input file should be a csv format which contains information about the |
|
22 | 21 |
|
23 | 22 | from __future__ import print_function |
24 | 23 |
|
| 24 | +from collections import namedtuple |
25 | 25 | import copy |
26 | 26 | import csv |
27 | 27 | import errno |
28 | 28 | import json |
29 | 29 | import logging |
30 | 30 | import optparse |
| 31 | +from os import makedirs |
31 | 32 | import os |
| 33 | +from os.path import exists, dirname, join, abspath, isdir, normpath, basename, expanduser |
32 | 34 | import shutil |
33 | 35 | import sys |
34 | 36 | import urllib |
35 | 37 | import urllib2 |
36 | | - |
37 | | -from collections import namedtuple |
38 | 38 | from urlparse import urljoin, urlparse |
39 | | -from os import makedirs |
40 | | -from os.path import exists, dirname, join, abspath, isdir, normpath, basename, expanduser |
41 | 39 |
|
42 | 40 | import about |
43 | 41 |
|
| 42 | + |
44 | 43 | __version__ = '2.0.2' |
45 | 44 |
|
46 | 45 | __copyright__ = """ |
@@ -597,22 +596,19 @@ def format_output(input_list): |
597 | 596 | """ |
598 | 597 | components_list = [] |
599 | 598 | for about_file_location, about_dict_list in input_list: |
600 | | - unified_dict_list = {} |
601 | | - for key in about_dict_list: |
602 | | - unified_dict_list[key] = u''.join(about_dict_list[key]) |
603 | 599 | component = [] |
604 | | - component_name = unified_dict_list.get('name', '') |
605 | | - component_version = unified_dict_list.get('version', '') |
| 600 | + component_name = about_dict_list.get('name', '') |
| 601 | + component_version = about_dict_list.get('version', '') |
606 | 602 | context = 'about_resource: %s\nname: %s\nversion: %s\n\n' % ( |
607 | | - unified_dict_list['about_resource'], component_name, component_version) |
| 603 | + about_dict_list['about_resource'], component_name, component_version) |
608 | 604 |
|
609 | | - for item in sorted(unified_dict_list.iterkeys()): |
| 605 | + for item in sorted(about_dict_list.iterkeys()): |
610 | 606 | if item == 'about_file': |
611 | 607 | continue |
612 | 608 | if not item in about.MANDATORY_FIELDS: |
613 | 609 | # The purpose of the replace('\n', '\n ') is used to |
614 | 610 | # format the continuation strings |
615 | | - value = unified_dict_list[item].replace('\n', '\n ') |
| 611 | + value = about_dict_list[item].replace('\n', '\n ') |
616 | 612 | if (value or item in about.MANDATORY_FIELDS) and not item\ |
617 | 613 | in about.ERROR_WARN_FIELDS and not item == 'about_resource': |
618 | 614 | context += item + ': ' + value + '\n' |
|
0 commit comments