refactor the version

pull/1361/head
huangyuxin 3 years ago
parent 4a133619a1
commit eb91ce84f9

@ -11,5 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = '0.1.1'
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"
)

@ -17,7 +17,6 @@ import io
import os
import subprocess as sp
import sys
import paddlespeech
from pathlib import Path
from setuptools import Command
@ -28,6 +27,8 @@ from setuptools.command.install import install
HERE = Path(os.path.abspath(os.path.dirname(__file__)))
PADDLESPEECH_VERSION = '0.1.1'
requirements = {
"install": [
"editdistance",
@ -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
def pushd(new_dir):
old_dir = os.getcwd()
@ -170,10 +180,12 @@ class UploadCommand(Command):
sys.exit()
write_version_py()
setup_info = dict(
# Metadata
name='paddlespeech',
version=paddlespeech.__version__,
version=PADDLESPEECH_VERSION,
author='PaddlePaddle Speech and Language Team',
author_email='paddlesl@baidu.com',
url='https://github.com/PaddlePaddle/PaddleSpeech',

Loading…
Cancel
Save