提交 eb91ce84 编写于 作者: H huangyuxin

refactor the version

上级 4a133619
...@@ -11,5 +11,10 @@ ...@@ -11,5 +11,10 @@
# 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:
__version__ = '0.1.1' 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"
)
...@@ -17,7 +17,6 @@ import io ...@@ -17,7 +17,6 @@ import io
import os import os
import subprocess as sp import subprocess as sp
import sys import sys
import paddlespeech
from pathlib import Path from pathlib import Path
from setuptools import Command from setuptools import Command
...@@ -28,6 +27,8 @@ from setuptools.command.install import install ...@@ -28,6 +27,8 @@ 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'
requirements = { requirements = {
"install": [ "install": [
"editdistance", "editdistance",
...@@ -83,6 +84,15 @@ requirements = { ...@@ -83,6 +84,15 @@ requirements = {
} }
def write_version_py(filename='paddlespeech/version.py'):
ver_str = """# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
#
full_version = '%(version)s'
"""
with open(filename, 'w') as f:
f.write(ver_str % {'version': PADDLESPEECH_VERSION})
@contextlib.contextmanager @contextlib.contextmanager
def pushd(new_dir): def pushd(new_dir):
old_dir = os.getcwd() old_dir = os.getcwd()
...@@ -170,10 +180,12 @@ class UploadCommand(Command): ...@@ -170,10 +180,12 @@ class UploadCommand(Command):
sys.exit() sys.exit()
write_version_py()
setup_info = dict( setup_info = dict(
# Metadata # Metadata
name='paddlespeech', name='paddlespeech',
version=paddlespeech.__version__, version=PADDLESPEECH_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',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册