forked from myshell-ai/MeloTTS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
60 lines (53 loc) · 1.69 KB
/
setup.py
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
import os
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
cwd = os.path.dirname(os.path.abspath(__file__))
def download_nltk_data():
import nltk
nltk.download('averaged_perceptron_tagger_eng')
# Read requirements from environment.yml
def parse_requirements(filename):
with open(filename, 'r') as file:
requirements = []
for line in file:
if line.strip().startswith('- pip:'):
break
for line in file:
if line.strip() and not line.strip().startswith('-'):
requirements.append(line.strip())
return requirements
reqs = parse_requirements('environment.yml')
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
install.run(self)
self.execute(download_nltk_data, (), msg="Downloading NLTK data")
os.system('python -m unidic download')
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
self.execute(download_nltk_data, (), msg="Downloading NLTK data")
os.system('python -m unidic download')
setup(
name='melotts',
version='0.1.2',
packages=find_packages(),
include_package_data=True,
install_requires=reqs,
package_data={
'': ['*.txt', 'cmudict_*'],
},
entry_points={
"console_scripts": [
"melotts = melo.main:main",
"melo = melo.main:main",
"melo-ui = melo.app:main",
],
},
cmdclass={
'develop': PostDevelopCommand,
'install': PostInstallCommand,
},
)