mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 09:44:36 +03:00
Update package CLI handling of README and LICENSE (#8422)
* Copy rather than move files to top-level of package * Add all files to `MANIFEST.in` (primarily for older versions of pip) * Include the `README.md` contents as `long_description` in the setup
This commit is contained in:
parent
30d4eb506a
commit
83fd04dee5
|
@ -133,7 +133,7 @@ def package(
|
||||||
for file_name in FILENAMES_DOCS:
|
for file_name in FILENAMES_DOCS:
|
||||||
file_path = package_path / model_name_v / file_name
|
file_path = package_path / model_name_v / file_name
|
||||||
if file_path.exists():
|
if file_path.exists():
|
||||||
shutil.move(str(file_path), str(main_path))
|
shutil.copy(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)
|
||||||
|
@ -248,6 +248,13 @@ def load_meta(fp):
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
def load_readme(fp):
|
||||||
|
if path.exists(fp):
|
||||||
|
with io.open(fp, encoding='utf8') as f:
|
||||||
|
return f.read()
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def list_files(data_dir):
|
def list_files(data_dir):
|
||||||
output = []
|
output = []
|
||||||
for root, _, filenames in walk(data_dir):
|
for root, _, filenames in walk(data_dir):
|
||||||
|
@ -273,6 +280,8 @@ def setup_package():
|
||||||
root = path.abspath(path.dirname(__file__))
|
root = path.abspath(path.dirname(__file__))
|
||||||
meta_path = path.join(root, 'meta.json')
|
meta_path = path.join(root, 'meta.json')
|
||||||
meta = load_meta(meta_path)
|
meta = load_meta(meta_path)
|
||||||
|
readme_path = path.join(root, 'README.md')
|
||||||
|
readme = load_readme(readme_path)
|
||||||
model_name = str(meta['lang'] + '_' + meta['name'])
|
model_name = str(meta['lang'] + '_' + meta['name'])
|
||||||
model_dir = path.join(model_name, model_name + '-' + meta['version'])
|
model_dir = path.join(model_name, model_name + '-' + meta['version'])
|
||||||
|
|
||||||
|
@ -282,6 +291,7 @@ def setup_package():
|
||||||
setup(
|
setup(
|
||||||
name=model_name,
|
name=model_name,
|
||||||
description=meta.get('description'),
|
description=meta.get('description'),
|
||||||
|
long_description=readme,
|
||||||
author=meta.get('author'),
|
author=meta.get('author'),
|
||||||
author_email=meta.get('email'),
|
author_email=meta.get('email'),
|
||||||
url=meta.get('url'),
|
url=meta.get('url'),
|
||||||
|
@ -303,6 +313,8 @@ if __name__ == '__main__':
|
||||||
TEMPLATE_MANIFEST = """
|
TEMPLATE_MANIFEST = """
|
||||||
include meta.json
|
include meta.json
|
||||||
include LICENSE
|
include LICENSE
|
||||||
|
include LICENSES_SOURCES
|
||||||
|
include README.md
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user