refacto the code

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

@ -13,11 +13,3 @@
# limitations under the License.
from .backends 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.
# See the License for the specific language governing permissions and
# 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__)))
PADDLESPEECH_VERSION = '0.1.1'
VERSION = '0.1.1'
requirements = {
"install": [
@ -84,13 +84,12 @@ requirements = {
}
def write_version_py(filename='paddlespeech/version.py'):
ver_str = """# THIS FILE IS GENERATED FROM PADDLESPEECH SETUP.PY
#
full_version = '%(version)s'
"""
with open(filename, 'w') as f:
f.write(ver_str % {'version': PADDLESPEECH_VERSION})
def write_version_py(filename='paddlespeech/__init__.py'):
import paddlespeech
if hasattr(paddlespeech, "__version__") and paddlespeech.__version__ == VERSION:
return
with open(filename, "a") as f:
f.write(f"\n__version__ = '{VERSION}'\n")
@contextlib.contextmanager
@ -185,7 +184,7 @@ write_version_py()
setup_info = dict(
# Metadata
name='paddlespeech',
version=PADDLESPEECH_VERSION,
version=VERSION,
author='PaddlePaddle Speech and Language Team',
author_email='paddlesl@baidu.com',
url='https://github.com/PaddlePaddle/PaddleSpeech',

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

Loading…
Cancel
Save