Return None in match_best_version if not path exists.

This commit is contained in:
Matthew Honnibal 2016-10-15 14:47:29 +02:00
parent 2516382106
commit 5e923b9bfa
1 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,8 @@ def or_(val1, val2):
def match_best_version(target_name, target_version, path): def match_best_version(target_name, target_version, path):
path = path if not isinstance(path, basestring) else pathlib.Path(path) path = path if not isinstance(path, basestring) else pathlib.Path(path)
if not path.exists():
return None
matches = [] matches = []
for data_name in path.iterdir(): for data_name in path.iterdir():
name, version = split_data_name(data_name.parts[-1]) name, version = split_data_name(data_name.parts[-1])