forked from erogol/WaveRNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
86 lines (74 loc) · 2.22 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
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
#!/usr/bin/env python
from setuptools import setup, find_packages
import setuptools.command.develop
import setuptools.command.build_py
import os
import subprocess
from os.path import exists
version = '0.0.1'
# Adapted from https://github.com/pytorch/pytorch
cwd = os.path.dirname(os.path.abspath(__file__))
if os.getenv('WAVERNN_PYTORCH_BUILD_VERSION'):
version = os.getenv('WAVERNN_PYTORCH_BUILD_VERSION')
else:
try:
sha = subprocess.check_output(
['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip()
version += '+' + sha[:7]
except subprocess.CalledProcessError:
pass
except IOError: # FileNotFoundError for python 3
pass
class build_py(setuptools.command.build_py.build_py):
def run(self):
self.create_version_file()
setuptools.command.build_py.build_py.run(self)
@staticmethod
def create_version_file():
global version, cwd
print('-- Building version ' + version)
version_path = os.path.join(cwd, 'version.py')
with open(version_path, 'w') as f:
f.write("__version__ = '{}'\n".format(version))
class develop(setuptools.command.develop.develop):
def run(self):
build_py.create_version_file()
setuptools.command.develop.develop.run(self)
def create_readme_rst():
global cwd
try:
subprocess.check_call(
[
"pandoc", "--from=markdown", "--to=rst", "--output=README.rst",
"README.md"
],
cwd=cwd)
print("Generated README.rst from README.md using pandoc.")
except subprocess.CalledProcessError:
pass
except OSError:
pass
setup(
name='WaveRNN',
version=version,
url='https://github.com/erogol/WaveRNN',
description='WaveRNN Vocoder implementation on Pytorch',
packages=find_packages(),
cmdclass={
'build_py': build_py,
'develop': develop,
},
setup_requires=["numpy>=1.14.3"],
install_requires=[
"scipy>=0.19.0",
"torch>=0.4.1",
"librosa>=0.5.1",
"unidecode>=0.4.20",
"matplotlib>=2.0.2",
],
extras_require={
"bin": [
"tqdm",
"requests",
],
})