mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Move README.md and LICENSES_SOURCES in package (#8297)
In addition to `LICENSE`, move the files `README.md` and `LICENSES_SOURCES` to the top directory in `spacy package` if present in the model directory.
This commit is contained in:
parent
dbbeab2506
commit
d9be9e6cf9
|
@ -113,7 +113,7 @@ def package(
|
||||||
print("\n".join(errors))
|
print("\n".join(errors))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
model_name = meta["name"]
|
model_name = meta["name"]
|
||||||
if not model_name.startswith(meta['lang'] + "_"):
|
if not model_name.startswith(meta["lang"] + "_"):
|
||||||
model_name = f"{meta['lang']}_{model_name}"
|
model_name = f"{meta['lang']}_{model_name}"
|
||||||
model_name_v = model_name + "-" + meta["version"]
|
model_name_v = model_name + "-" + meta["version"]
|
||||||
main_path = output_dir / model_name_v
|
main_path = output_dir / model_name_v
|
||||||
|
@ -130,9 +130,10 @@ def package(
|
||||||
)
|
)
|
||||||
Path.mkdir(package_path, parents=True)
|
Path.mkdir(package_path, parents=True)
|
||||||
shutil.copytree(str(input_dir), str(package_path / model_name_v))
|
shutil.copytree(str(input_dir), str(package_path / model_name_v))
|
||||||
license_path = package_path / model_name_v / "LICENSE"
|
for file_name in FILENAMES_DOCS:
|
||||||
if license_path.exists():
|
file_path = package_path / model_name_v / file_name
|
||||||
shutil.move(str(license_path), str(main_path))
|
if file_path.exists():
|
||||||
|
shutil.move(str(file_path), str(main_path))
|
||||||
imports = []
|
imports = []
|
||||||
for code_path in code_paths:
|
for code_path in code_paths:
|
||||||
imports.append(code_path.stem)
|
imports.append(code_path.stem)
|
||||||
|
@ -317,3 +318,6 @@ __version__ = get_model_meta(Path(__file__).parent)['version']
|
||||||
def load(**overrides):
|
def load(**overrides):
|
||||||
return load_model_from_init_py(__file__, **overrides)
|
return load_model_from_init_py(__file__, **overrides)
|
||||||
""".lstrip()
|
""".lstrip()
|
||||||
|
|
||||||
|
|
||||||
|
FILENAMES_DOCS = ["LICENSE", "LICENSES_SOURCES", "README.md"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user