-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsetup.py
More file actions
106 lines (87 loc) · 3.22 KB
/
Copy pathsetup.py
File metadata and controls
106 lines (87 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: liekkaskono@163.com
import sys
from pathlib import Path
from typing import Dict, List, Optional, Union
import setuptools
from get_pypi_latest_version import GetPyPiLatestVersion
def read_txt(txt_path: Union[Path, str]) -> List[str]:
with open(txt_path, "r", encoding="utf-8") as f:
data = [v.rstrip("\n") for v in f]
return data
def read_requirement_groups(txt_path: Union[Path, str]) -> Dict[str, List[str]]:
groups: Dict[str, List[str]] = {}
current_group: Optional[str] = None
for raw_line in read_txt(txt_path):
line = raw_line.strip()
if not line:
continue
if line.startswith("# [") and line.endswith("]"):
current_group = line[3:-1].strip()
groups.setdefault(current_group, [])
continue
if line.startswith("#"):
continue
if current_group is None:
raise ValueError(f"Requirement line is outside a group: {line}")
groups[current_group].append(line)
return groups
def get_readme():
root_dir = Path(__file__).resolve().parent
readme_path = str(root_dir / "docs" / "doc_whl_rapidtts.md")
print(readme_path)
with open(readme_path, "r", encoding="utf-8") as f:
readme = f.read()
return readme
MODULE_NAME = "rapidtts"
REQUIREMENT_GROUPS = read_requirement_groups("requirements.txt")
COMMON_REQUIRES = REQUIREMENT_GROUPS["common"]
KOKORO_REQUIRES = REQUIREMENT_GROUPS["kokoro"]
MELO_REQUIRES = REQUIREMENT_GROUPS["melo"]
MOSS_NANO_REQUIRES = REQUIREMENT_GROUPS["moss_nano"]
obtainer = GetPyPiLatestVersion()
try:
latest_version = obtainer(MODULE_NAME)
except Exception:
latest_version = "0.0.0"
VERSION_NUM = obtainer.version_add_one(latest_version, add_patch=True)
if len(sys.argv) > 2:
match_str = " ".join(sys.argv[2:])
matched_versions = obtainer.extract_version(match_str)
if matched_versions:
VERSION_NUM = matched_versions
sys.argv = sys.argv[:2]
setuptools.setup(
name=MODULE_NAME,
version=VERSION_NUM,
platforms="Any",
description="A text-to-speech framework for fast and high-quality speech synthesis.",
long_description=get_readme(),
long_description_content_type="text/markdown",
author="SWHL",
author_email="liekkaskono@163.com",
url="https://github.com/RapidAI/RapidTTS",
license="Apache-2.0",
include_package_data=True,
install_requires=COMMON_REQUIRES,
extras_require={
"kokoro": KOKORO_REQUIRES,
"melo": MELO_REQUIRES,
"moss_nano": MOSS_NANO_REQUIRES,
"all": KOKORO_REQUIRES + MELO_REQUIRES + MOSS_NANO_REQUIRES,
},
packages=setuptools.find_packages(include=[MODULE_NAME, f"{MODULE_NAME}.*"]),
package_data={MODULE_NAME: ["configs/*.yaml"]},
entry_points={"console_scripts": ["rapidtts=rapidtts.cli:main"]},
keywords=["tts,rapidtts,melotts"],
classifiers=[
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
],
python_requires=">=3.9,<4",
)