Resolve model name properly in cli.info

Use util.resolve_model_path() to also allow package names and paths.
This commit is contained in:
ines 2017-05-20 12:24:40 +02:00
parent 5163a4513e
commit e39ad78267

View File

@ -11,15 +11,14 @@ from .. import util
def info(model=None, markdown=False): def info(model=None, markdown=False):
if model: if model:
data_path = util.get_data_path() model_path = util.resolve_model_path(model)
data = util.parse_package_meta(data_path / model, require=True) meta = util.parse_package_meta(model_path)
model_path = Path(__file__).parent / data_path / model
if model_path.resolve() != model_path: if model_path.resolve() != model_path:
data['link'] = path2str(model_path) meta['link'] = path2str(model_path)
data['source'] = path2str(model_path.resolve()) meta['source'] = path2str(model_path.resolve())
else: else:
data['source'] = path2str(model_path) meta['source'] = path2str(model_path)
print_info(data, 'model %s' % model, markdown) print_info(meta, 'model %s' % model, markdown)
else: else:
data = {'spaCy version': about.__version__, data = {'spaCy version': about.__version__,
'Location': path2str(Path(__file__).parent.parent), 'Location': path2str(Path(__file__).parent.parent),