mirror of https://github.com/tLDP/python-tldp
load the MD5 file, if present
if the MD5 file is not present, then an earlier version of the tldp package generated the output directory, and we should re-run if the MD5 file is present in the output directory, load it into the dict() data structure and return it, so that a stale-check can be completed
This commit is contained in:
parent
5dcc255cc6
commit
5a06b49967
|
@ -7,6 +7,7 @@ from __future__ import unicode_literals
|
|||
import os
|
||||
import sys
|
||||
import errno
|
||||
import codecs
|
||||
import logging
|
||||
|
||||
from tldp.ldpcollection import LDPDocumentCollection
|
||||
|
@ -91,10 +92,16 @@ class OutputNamingConvention(object):
|
|||
@property
|
||||
def md5sums(self):
|
||||
d = dict()
|
||||
with codecs.open(self.MD5SUMS, encoding='utf-8') as f:
|
||||
for line in f:
|
||||
hashval, fname = line.strip().split()
|
||||
d[fname] = hashval
|
||||
try:
|
||||
with codecs.open(self.MD5SUMS, encoding='utf-8') as f:
|
||||
for line in f:
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
hashval, fname = line.strip().split()
|
||||
d[fname] = hashval
|
||||
except IOError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
return d
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue