avoid using backslash and fix typo issue.

This commit is contained in:
Franz Chih-Ping Hsieh 2018-02-07 18:20:41 +00:00 committed by Mike McLean
parent 47c85e8833
commit ac88d5aa91
2 changed files with 5 additions and 3 deletions

View file

@ -2418,8 +2418,10 @@ def _write_maven_repo_metadata(destdir, artifacts):
# Sort the list so that the highest version number comes last.
# group_id and artifact_id should be the same for all entries,
# so we're really only comparing versions.
sort_param = {'key': functools.cmp_to_key(rpm.labelCompare)} if six.PY3 else \
{'cmp': lambda a, b: rpm.labelCompare(a, b)}
if six.PY3:
sort_param = {'key': functools.cmp_to_key(rpm.labelCompare)}
else:
sort_param = {'cmp': lambda a, b: rpm.labelCompare(a, b)}
artifacts = sorted(artifacts, **sort_param)
artifactinfo = dict(zip(['group_id', 'artifact_id', 'version'], artifacts[-1]))
artifactinfo['timestamp'] = datetime.datetime.now().strftime('%Y%m%d%H%M%S')

View file

@ -722,7 +722,7 @@ def canceltask(environ, taskID):
_redirect(environ, 'taskinfo?taskID=%i' % taskID)
def _sortByExtAndName(item):
"""Sort filename tuples key funtion, first by extension, and then by name."""
"""Sort filename tuples key function, first by extension, and then by name."""
kRoot, kExt = os.path.splitext(os.path.basename(item[1]))
return (kExt, kRoot)