[IMP] merge split map and filter into a single listcomp

bzr revid: xmo@openerp.com-20111025111213-6ryfsuv1jzfetxmu
This commit is contained in:
Xavier Morel 2011-10-25 13:12:13 +02:00
parent 0132b2ebd0
commit b3803586d3
1 changed files with 5 additions and 11 deletions

View File

@ -60,17 +60,11 @@ if __name__ == "__main__":
if os.path.exists(path_addons): if os.path.exists(path_addons):
options.addons_path.append(path_addons) options.addons_path.append(path_addons)
def remove_end_slash(text): options.addons_path = [
if text[-1] in '/\\': path[:-1] if path[-1] in r'\/' else path
return text[:-1] for path in options.addons_path
return text if os.path.exists(path)
]
def drop_false_path(path):
if os.path.exists(path):
return True
options.addons_path = map(remove_end_slash, options.addons_path)
options.addons_path = filter(drop_false_path, options.addons_path)
for path_addons in options.addons_path: for path_addons in options.addons_path:
if path_addons not in sys.path: if path_addons not in sys.path: