Bug fix: only try to preserve outphased library information is there is any stored locally.

This commit is contained in:
Achim D. Brucker 2017-09-03 11:09:39 +01:00
parent 80c8e7caa0
commit 0f716e98da
1 changed files with 12 additions and 9 deletions

View File

@ -121,15 +121,18 @@ def update_lib(verbose, force, archive, lib):
lib_ver['files'] = files_with_hashes
outphased = []
for lib_ver in local_lib_json['assets']:
version = lib_ver['version']
if not version in cdnjs_versions:
logging.warning("Found outphased versions for " + name + " " + str(
version) + " , preserving from archive.")
outphased.append(lib_ver)
if outphased:
cdnjs_lib_json['assets'] = cdnjs_lib_json['assets'] + outphased
if local_lib_json is not None:
outphased = []
for lib_ver in local_lib_json['assets']:
version = lib_ver['version']
if not version in cdnjs_versions:
logging.warning("Found outphased versions for " + name + " " + str(
version) + " , preserving from archive.")
if not 'outphased' in lib_ver:
lib_ver['outphased'] = datetime.datetime.utcnow().isoformat()
outphased.append(lib_ver)
if outphased:
cdnjs_lib_json['assets'] = cdnjs_lib_json['assets'] + outphased
output = os.path.join(dirname, name + ".json")
if verbose: