Skip to content

Commit b36e717

Browse files
committed
Merge remote-tracking branch 'origin/release-v1.02'
2 parents 952f957 + 9e7b566 commit b36e717

File tree

14 files changed

+127
-68
lines changed

14 files changed

+127
-68
lines changed

about.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
about_resource: .
22

33
name: AboutCode
4-
version: 1.0.1
4+
version: 1.0.2
55

66

77
owner: nexB Inc.

about_code_tool/about.py

Lines changed: 75 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import ntpath
4747

4848

49-
__version__ = '1.0.1'
49+
__version__ = '1.0.2'
5050

5151
# See http://dejacode.org
5252
__about_spec_version__ = '1.0'
@@ -1270,49 +1270,81 @@ def generate_attribution(self, template_path=None, limit_to=None):
12701270
not_process_components = list(limit_to)
12711271
component_exist = False
12721272

1273-
for component in not_process_components:
1273+
# Following code contains duplication and perhaps needs to do some
1274+
# refactoring
1275+
if limit_to:
1276+
for component in not_process_components:
1277+
for about_object in self:
1278+
# The about_object.location is the absolute path of the ABOUT
1279+
# file. The purpose of the following partition is to match
1280+
# the about_file's location with the input list.
1281+
about_relative_path = about_object.location.partition(
1282+
normpath(self.location))[2]
1283+
if component == about_relative_path:
1284+
component_exist = True
1285+
about_content = about_object.validated_fields
1286+
if '\n' in about_object.get_dje_license_name():
1287+
msg = ('Multiple licenses is not supported. '
1288+
'Skipping License generation.')
1289+
err = Error(GENATTRIB, 'dje_license',
1290+
about_object.get_dje_license_name(), msg)
1291+
self.genattrib_errors.append(err)
1292+
1293+
lic_text = unicode(about_object.license_text(),
1294+
errors='replace')
1295+
notice_text = unicode(about_object.notice_text(),
1296+
errors='replace')
1297+
about_content['license_text'] = lic_text
1298+
about_content['notice_text'] = notice_text
1299+
1300+
license_dict[about_object.get_dje_license_name()] = about_content['license_text']
1301+
1302+
# report error if no license_text is found
1303+
if not about_content.get('license_text')\
1304+
and not about_content.get('notice_text')\
1305+
and not '\n' in about_object.get_dje_license_name():
1306+
msg = ('No license_text found. '
1307+
'Skipping License generation.')
1308+
err = Error(GENATTRIB, 'name',
1309+
about_object.get_about_name(), msg)
1310+
self.genattrib_errors.append(err)
1311+
about_object_fields.append(about_content)
1312+
break
1313+
if not component_exist:
1314+
loc = self.location + component
1315+
msg = ('The requested ABOUT file: %r does not exist. '
1316+
'No attribution generated for this file.' % loc)
1317+
err = Error(GENATTRIB, 'about_file', loc, msg)
1318+
self.genattrib_errors.append(err)
1319+
else:
12741320
for about_object in self:
1275-
# The about_object.location is the absolute path of the ABOUT
1276-
# file. The purpose of the following partition is to match
1277-
# the about_file's location with the input list.
1278-
about_relative_path = about_object.location.partition(
1279-
normpath(self.location))[2]
1280-
1281-
if component == about_relative_path:
1282-
component_exist = True
1283-
about_content = about_object.validated_fields
1284-
if '\n' in about_object.get_dje_license_name():
1285-
msg = ('Multiple licenses is not supported. '
1286-
'Skipping License generation.')
1287-
err = Error(GENATTRIB, 'dje_license',
1288-
about_object.get_dje_license_name(), msg)
1289-
self.genattrib_errors.append(err)
1290-
1291-
lic_text = unicode(about_object.license_text(),
1292-
errors='replace')
1293-
notice_text = unicode(about_object.notice_text(),
1294-
errors='replace')
1295-
about_content['license_text'] = lic_text
1296-
about_content['notice_text'] = notice_text
1297-
1298-
license_dict[about_object.get_dje_license_name()] = about_content['license_text']
1299-
1300-
# report error if no license_text is found
1301-
if not about_content.get('license_text')\
1302-
and not about_content.get('notice_text')\
1303-
and not '\n' in about_object.get_dje_license_name():
1304-
msg = ('No license_text found. '
1305-
'Skipping License generation.')
1306-
err = Error(GENATTRIB, 'name',
1307-
about_object.get_about_name(), msg)
1308-
self.genattrib_errors.append(err)
1309-
about_object_fields.append(about_content)
1310-
break
1311-
if not component_exist:
1312-
msg = ('The requested ABOUT file: %r does not exist. '
1313-
'No attribution generated for this file.' % component)
1314-
err = Error(GENATTRIB, 'about_file', component, msg)
1315-
self.genattrib_errors.append(err)
1321+
about_content = about_object.validated_fields
1322+
if '\n' in about_object.get_dje_license_name():
1323+
msg = ('Multiple licenses is not supported. '
1324+
'Skipping License generation.')
1325+
err = Error(GENATTRIB, 'dje_license',
1326+
about_object.get_dje_license_name(), msg)
1327+
self.genattrib_errors.append(err)
1328+
1329+
lic_text = unicode(about_object.license_text(),
1330+
errors='replace')
1331+
notice_text = unicode(about_object.notice_text(),
1332+
errors='replace')
1333+
about_content['license_text'] = lic_text
1334+
about_content['notice_text'] = notice_text
1335+
1336+
license_dict[about_object.get_dje_license_name()] = about_content['license_text']
1337+
1338+
# report error if no license_text is found
1339+
if not about_content.get('license_text')\
1340+
and not about_content.get('notice_text')\
1341+
and not '\n' in about_object.get_dje_license_name():
1342+
msg = ('No license_text found. '
1343+
'Skipping License generation.')
1344+
err = Error(GENATTRIB, 'name',
1345+
about_object.get_about_name(), msg)
1346+
self.genattrib_errors.append(err)
1347+
about_object_fields.append(about_content)
13161348

13171349
# We want to display common_licenses in alphabetical order
13181350
license_key = []

about_code_tool/genabout.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
import about
4242

43-
__version__ = '1.0.1'
43+
__version__ = '1.0.2'
4444

4545
__copyright__ = """
4646
Copyright (c) 2013-2014 nexB Inc. All rights reserved.
@@ -176,7 +176,7 @@ def validate(self, input_list):
176176
print("No ABOUT file is created.")
177177
sys.exit(errno.EINVAL)
178178
if self.validate_duplication(input_list):
179-
print("The input has duplicated 'about_file' and 'about_resource'.")
179+
print("The input has duplicated 'about_file'.")
180180
print("Duplication is not supported. Please correct the input and rerun the tool.")
181181
print("No ABOUT file is created.")
182182
sys.exit(errno.EINVAL)
@@ -689,8 +689,7 @@ def main(parser, options, args):
689689
mapping_keys = []
690690

691691
if options.version:
692-
msg = 'AboutCode %(__version__)s\n%(__copyright__)s'.format(globals())
693-
print(msg)
692+
print('ABOUT tool {0}\n{1}'.format(__version__, __copyright__))
694693
sys.exit(0)
695694

696695
if verbosity == 1:

about_code_tool/genattrib.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
logger.addHandler(handler)
4444
file_logger = logging.getLogger(__name__ + '_file')
4545

46-
__version__ = '1.0.1'
46+
__version__ = '1.0.2'
4747

4848
__about_spec_version__ = '1.0.0' # See http://dejacode.org
4949

@@ -149,12 +149,17 @@ def main(parser, options, args):
149149
print("The file 'MAPPING.CONFIG' does not exist.")
150150
sys.exit(errno.EINVAL)
151151

152-
if not len(args) == 3:
153-
print('Path for input, output and component list are required.\n')
152+
if not len(args) >= 2 and not len(args) < 4:
153+
print('Path for input and output are required.\n')
154154
parser.print_help()
155155
sys.exit(errno.EEXIST)
156156

157-
input_path, output_path, component_subset_path = args
157+
input_path = args[0]
158+
output_path = args[1]
159+
if len(args) == 3:
160+
component_subset_path = args[2]
161+
else:
162+
component_subset_path = ""
158163

159164
# TODO: need more path normalization (normpath, expanduser)
160165
input_path = expanduser(normpath(input_path))
@@ -172,10 +177,16 @@ def main(parser, options, args):
172177
sys.exit(errno.EEXIST)
173178

174179
if isdir(output_path):
175-
print('Output must be a file, not a directory.')
180+
print('Output must be a HTML file.')
176181
parser.print_help()
177182
sys.exit(errno.EISDIR)
178183

184+
# We only support HTML currently
185+
if not output_path.endswith('.html'):
186+
print('Output must be a HTML file.')
187+
parser.print_help()
188+
sys.exit(errno.EINVAL)
189+
179190
if exists(output_path) and not overwrite:
180191
print('Output file already exists. Select a different file name '
181192
'or use the --overwrite option.')
@@ -196,6 +207,7 @@ def main(parser, options, args):
196207

197208
if not exists(output_path) or (exists(output_path) and overwrite):
198209
collector = Collector(input_path)
210+
outlist = None
199211
if not component_subset_path:
200212
sublist = None
201213
else:

configure

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Copyright (c) 2014 nexB Inc. http://www.nexb.com/ - All rights reserved.
44
#
55

6-
set -e
76
CFG_CMD_LINE_ARGS="$@"
87

98
if [ "$1" == "" ]; then

etc/conf/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Base
22
certifi==14.05.14
3-
setuptools==5.6
3+
setuptools==7.0
44
wheel==0.24.0
55
pip==1.5.6
66

etc/configure

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
# Copyright (c) 2014 nexB Inc. http://www.nexb.com/ - All rights reserved.
44
#
55

6-
set -e
7-
86
ETC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
97
ROOT_DIR="$( dirname "$ETC_DIR" )"
108

119
if [ "$1" == "--clean" ]; then
1210
echo "* Cleaning ..."
13-
cd $ROOT_DIR && rm -rf build bin lib include django_background_task.log
14-
cd $ROOT_DIR && rm -rf develop-eggs eggs parts .installed.cfg
11+
cd $ROOT_DIR && rm -rf build bin lib include dist about_code_tool.egg-info
1512
exit 0
1613
fi
1714

etc/getconf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
On posix, posix Python and shell scripts are executed before mac or linux
4141
scripts.
4242
43+
The base scripts or packages are always installed first before platform-specific ones.
44+
4345
For example a tree could be looking like this::
4446
etc/conf
4547
base.txt : base pip requirements for all platforms
@@ -81,10 +83,10 @@
8183
base = ('base',)
8284

8385
# known full file names with txt extension for requirements
84-
requirements = tuple(p + '.txt' for p in base + platform_names)
86+
requirements = tuple(p + '.txt' for p in platform_names + base)
8587

8688
# known full file names with py extensions for scripts
87-
python_scripts = tuple(p + '.py' for p in base + platform_names)
89+
python_scripts = tuple(p + '.py' for p in platform_names + base)
8890

8991
# known full file names of shell scripts
9092
shell_scripts = tuple(p + '.sh' for p in platform_names)

thirdparty/MarkupSafe.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dje_license: bsd-new
99

1010
vcs_tool: git
1111
vcs_repository: https://github.com/mitsuhiko/jinja2.git
12-
license_text_file:MarkupSafe.LICENSE
12+
license_text_file: MarkupSafe.LICENSE
1313

1414
copyright: Copyright (c) 2010 by Armin Ronacher and contributors.
1515
owner: Armin Ronacher

thirdparty/pip.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ about_resource: pip-1.5.6-py2.py3-none-any.whl
22
version: 1.5.6
33
download_url: https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz#md5=01026f87978932060cc86c1dc527903e
44

5-
name:pip
5+
name: pip
66
owner: The pip developers
77
88
home_url: http://www.pip-installer.org

0 commit comments

Comments
 (0)