[fix] at installation the cache dir might not be present

This commit is contained in:
Laurent Peuch 2016-11-29 20:36:13 +01:00
parent b5fda77b17
commit 54a50a40b9

View file

@ -523,10 +523,12 @@ class ActionsMap(object):
with open(am_file, 'r') as f:
actionsmaps[n] = yaml.load(f)
# clean old cached files
for i in os.listdir('%s/actionsmap/' % pkg.cachedir):
if i.endswith(".pkl"):
os.remove('%s/actionsmap/%s' % (pkg.cachedir, i))
# at installation, cachedir might not exists
if os.path.exists('%s/actionsmap/' % pkg.cachedir):
# clean old cached files
for i in os.listdir('%s/actionsmap/' % pkg.cachedir):
if i.endswith(".pkl"):
os.remove('%s/actionsmap/%s' % (pkg.cachedir, i))
# Cache actions map into pickle file
am_file_stat = os.stat(am_file)