Skip to content

Commit

Permalink
setup with ubuntu deps
Browse files Browse the repository at this point in the history
  • Loading branch information
zh794390558 committed Oct 19, 2021
1 parent 58fe852 commit ba28c92
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*.done
*.whl
*.egg-info
build

docs/build/

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ timer
pyworld
jieba
phkit

yq
80 changes: 79 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

from setuptools import find_packages
from setuptools import setup
from setuptools import Command
from setuptools.command.develop import develop
from setuptools.command.install import install
import subprocess as sp

HERE = os.path.abspath(os.path.dirname(__file__))


def read(*names, **kwargs):
Expand All @@ -29,17 +35,82 @@ def read(*names, **kwargs):
long_description = read("README.md")
deps = [d.strip() for d in read('requirements.txt').split()]


def _pre_install():
sp.check_call("apt-get update -y".split())
sp.check_call("apt-get install -y".split() +
'vim tig tree sox pkg-config'.split() +
'libsndfile1 libflac-dev libogg-dev'.split() +
'libvorbis-dev libboost-dev swig python3-dev'.split())


def _post_install(install_lib_dir):
pass


class DevelopCommand(develop):
def run(self):
_pre_install()
develop.run(self)
self.execute(_post_install, (self.install_lib, ), msg="Post Install...")


class InstallCommand(install):
def run(self):
_pre_install()
install.run(self)
self.execute(_post_install, (self.install_lib, ), msg="Post Install...")


# cmd: python setup.py upload
class UploadCommand(Command):
description = "Build and publish the package."
user_options = []

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
try:
print("Removing previous dist/ ...")
shutil.rmtree(os.path.join(HERE, "dist"))
except OSError:
pass
print("Building source distribution...")
sp.check_call([sys.executable, "setup.py", "sdist"])
print("Uploading package to PyPi...")
sp.check_call(["twine", "upload", "dist/*"])
sys.exit()


setup_info = dict(
# Metadata
name='paddle-speech',
version=VERSION,
author='PaddleSL Speech Team',
author_email='',
url='https://github.com/PaddlePaddle/DeepSpeech',
license='Apache 2',
description='Speech tools and models based on Paddlepaddle',
long_description=long_description,
long_description_content_type="text/markdown",
license='Apache 2',
keywords=[
"speech",
"asr",
"tts",
"text frontend",
"MFA",
"paddlepaddle",
"transformer",
"conformer",
"fastspeech",
"vocoder",
"pwgan",
"gan",
],
python_requires='>=3.6',
install_requires=deps,
extras_require={
Expand All @@ -48,6 +119,11 @@ def read(*names, **kwargs):
"recommonmark>=0.5.0", "sphinx-markdown-tables", "sphinx-autobuild"
],
},
cmdclass={
'develop': DevelopCommand,
'install': InstallCommand,
'upload': UploadCommand,
},

# Package info
packages=find_packages(exclude=('tests', 'tests.*')),
Expand All @@ -58,6 +134,8 @@ def read(*names, **kwargs):
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source tools/venv/bin/activate

# install python dependencies
if [ -f "requirements.txt" ]; then
pip3 install -r requirements.txt
pip3 install .
fi
if [ $? != 0 ]; then
error_msg "Install python dependencies failed !!!"
Expand Down

0 comments on commit ba28c92

Please sign in to comment.