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 os
|
||||||
import sys
|
import sys
|
||||||
import errno
|
import errno
|
||||||
|
import codecs
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from tldp.ldpcollection import LDPDocumentCollection
|
from tldp.ldpcollection import LDPDocumentCollection
|
||||||
|
@ -91,10 +92,16 @@ class OutputNamingConvention(object):
|
||||||
@property
|
@property
|
||||||
def md5sums(self):
|
def md5sums(self):
|
||||||
d = dict()
|
d = dict()
|
||||||
with codecs.open(self.MD5SUMS, encoding='utf-8') as f:
|
try:
|
||||||
for line in f:
|
with codecs.open(self.MD5SUMS, encoding='utf-8') as f:
|
||||||
hashval, fname = line.strip().split()
|
for line in f:
|
||||||
d[fname] = hashval
|
if line.startswith('#'):
|
||||||
|
continue
|
||||||
|
hashval, fname = line.strip().split()
|
||||||
|
d[fname] = hashval
|
||||||
|
except IOError as e:
|
||||||
|
if e.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue