Fix #578 -- Sputnik had been purging all files on --force, not just the relevant one.

This commit is contained in:
Matthew Honnibal 2016-11-04 10:44:11 +01:00
parent 6e37ba1d82
commit ab952b4756

View File

@ -11,13 +11,12 @@ from . import util
def download(lang, force=False, fail_on_exist=True):
if force:
sputnik.purge(about.__title__, about.__version__)
try:
sputnik.package(about.__title__, about.__version__,
pkg = sputnik.package(about.__title__, about.__version__,
about.__models__.get(lang, lang))
if fail_on_exist:
if force:
shutil.rmtree(pkg.path)
elif fail_on_exist:
print("Model already installed. Please run 'python -m "
"spacy.%s.download --force' to reinstall." % lang, file=sys.stderr)
sys.exit(0)