mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
Merge pull request #982 from oroszgy/cli_package_fix
Fixed python2 issue with the package command
This commit is contained in:
commit
21b33fcce1
|
@ -6,9 +6,15 @@ import shutil
|
||||||
import requests
|
import requests
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from .. import about
|
from .. import about
|
||||||
from .. import util
|
from .. import util
|
||||||
|
|
||||||
|
if six.PY2:
|
||||||
|
json_dumps = lambda data: json.dumps(data, indent=2).decode("utf8")
|
||||||
|
elif six.PY3:
|
||||||
|
json_dumps = lambda data: json.dumps(data, indent=2)
|
||||||
|
|
||||||
def package(input_dir, output_dir, force):
|
def package(input_dir, output_dir, force):
|
||||||
input_path = Path(input_dir)
|
input_path = Path(input_dir)
|
||||||
|
@ -27,7 +33,7 @@ def package(input_dir, output_dir, force):
|
||||||
|
|
||||||
create_dirs(package_path, force)
|
create_dirs(package_path, force)
|
||||||
shutil.copytree(input_path.as_posix(), (package_path / model_name_v).as_posix())
|
shutil.copytree(input_path.as_posix(), (package_path / model_name_v).as_posix())
|
||||||
create_file(main_path / 'meta.json', json.dumps(meta, indent=2))
|
create_file(main_path / 'meta.json', json_dumps(meta))
|
||||||
create_file(main_path / 'setup.py', template_setup)
|
create_file(main_path / 'setup.py', template_setup)
|
||||||
create_file(main_path / 'MANIFEST.in', template_manifest)
|
create_file(main_path / 'MANIFEST.in', template_manifest)
|
||||||
create_file(package_path / '__init__.py', template_init)
|
create_file(package_path / '__init__.py', template_init)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user