refacto the code

pull/1361/head
huangyuxin 3 years ago
parent 565a63c5ef
commit 4e31247633

@ -13,11 +13,3 @@
# limitations under the License. # limitations under the License.
from .backends import * from .backends import *
from .features import * from .features import *
try:
from .version import full_version as __version__
except ImportError:
import sys
sys.stderr.write(
"Warning: import paddlaudio from source directory without installing, run 'python setup_audio.py install' to install paddlespeech firstly\n"
)

@ -11,10 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
try:
from .version import full_version as __version__
except ImportError:
import sys
sys.stderr.write(
"Warning: import paddlespeech from source directory without installing, run 'python setup.py install' to install paddlespeech firstly.\n"
)

@ -27,7 +27,7 @@ from setuptools.command.install import install
HERE = Path(os.path.abspath(os.path.dirname(__file__))) HERE = Path(os.path.abspath(os.path.dirname(__file__)))
PADDLESPEECH_VERSION = '0.1.1' VERSION = '0.1.1'
requirements = { requirements = {
"install": [ "install": [
@ -84,13 +84,12 @@ requirements = {
} }
def write_version_py(filename='paddlespeech/version.py'): def write_version_py(filename='paddlespeech/__init__.py'):
ver_str = """# THIS FILE IS GENERATED FROM PADDLESPEECH SETUP.PY import paddlespeech
# if hasattr(paddlespeech, "__version__") and paddlespeech.__version__ == VERSION:
full_version = '%(version)s' return
""" with open(filename, "a") as f:
with open(filename, 'w') as f: f.write(f"\n__version__ = '{VERSION}'\n")
f.write(ver_str % {'version': PADDLESPEECH_VERSION})
@contextlib.contextmanager @contextlib.contextmanager
@ -185,7 +184,7 @@ write_version_py()
setup_info = dict( setup_info = dict(
# Metadata # Metadata
name='paddlespeech', name='paddlespeech',
version=PADDLESPEECH_VERSION, version=VERSION,
author='PaddlePaddle Speech and Language Team', author='PaddlePaddle Speech and Language Team',
author_email='paddlesl@baidu.com', author_email='paddlesl@baidu.com',
url='https://github.com/PaddlePaddle/PaddleSpeech', url='https://github.com/PaddlePaddle/PaddleSpeech',

@ -14,23 +14,22 @@
import setuptools import setuptools
# set the version here # set the version here
PADDLEAUDIO_VERSION = '0.1.0' VERSION = '0.1.0'
def write_version_py(filename='paddleaudio/version.py'): def write_version_py(filename='paddleaudio/__init__.py'):
ver_str = """# THIS FILE IS GENERATED FROM SETUP_AUDIO.PY import paddleaudio
# if hasattr(paddleaudio, "__version__") and paddleaudio.__version__ == VERSION:
full_version = '%(version)s' return
""" with open(filename, "a") as f:
with open(filename, 'w') as f: f.write(f"\n__version__ = '{VERSION}'\n")
f.write(ver_str % {'version': PADDLEAUDIO_VERSION})
write_version_py() write_version_py()
setuptools.setup( setuptools.setup(
name="paddleaudio", name="paddleaudio",
version=PADDLEAUDIO_VERSION, version=VERSION,
author="", author="",
author_email="", author_email="",
description="PaddleAudio, in development", description="PaddleAudio, in development",

Loading…
Cancel
Save