Merge pull request #128 from YunoHost/fix_installation

[fix] at installation the cache dir might not be present
This commit is contained in:
Laurent Peuch 2016-11-30 18:34:44 +01:00 committed by GitHub
commit 8404b03c87

View file

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