From 918a54571baa9cd28d0acce5fe816bb8cb5e9f92 Mon Sep 17 00:00:00 2001 From: Sijun He Date: Fri, 23 Dec 2022 20:09:20 +0800 Subject: [PATCH] fix version (#4226) --- paddlenlp/VERSION | 1 - paddlenlp/__init__.py | 4 +--- scripts/should_deploy.py | 21 +++++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 paddlenlp/VERSION diff --git a/paddlenlp/VERSION b/paddlenlp/VERSION deleted file mode 100644 index 62e64205bf38..000000000000 --- a/paddlenlp/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.4.6 \ No newline at end of file diff --git a/paddlenlp/__init__.py b/paddlenlp/__init__.py index 3095674f1378..c7eb16c310f3 100644 --- a/paddlenlp/__init__.py +++ b/paddlenlp/__init__.py @@ -12,11 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import sys -with open(os.path.join(os.path.dirname(__file__), "VERSION")) as fp: - __version__ = fp.read().strip() +__version__ = "2.4.7" if "datasets" in sys.modules.keys(): from paddlenlp.utils.log import logger diff --git a/scripts/should_deploy.py b/scripts/should_deploy.py index 23e477663dac..5be7c1947cce 100644 --- a/scripts/should_deploy.py +++ b/scripts/should_deploy.py @@ -20,8 +20,6 @@ from pkg_resources import parse_version -PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - def read_version_of_remote_package(name: str) -> str: """get version of remote package, @@ -66,16 +64,23 @@ def read_version_of_local_package(version_file_path: str) -> str: args = parser.parse_args() version_file_map = { - "paddlenlp": "paddlenlp/VERSION", "ppdiffusers": "ppdiffusers/VERSION", "paddle-pipelines": "pipelines/VERSION", } - if args.name not in version_file_map: - raise ValueError(f"package<{args.name}> not supported") - - local_version_file = os.path.join(PROJECT_ROOT, version_file_map[args.name]) remote_version = read_version_of_remote_package(args.name) - local_version = read_version_of_local_package(local_version_file) + + # tmp fix + if args.name == "paddlenlp": + sys.path.append(".") + from paddlenlp import __version__ + + local_version = __version__ + elif args.name in version_file_map: + PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + local_version_file = os.path.join(PROJECT_ROOT, version_file_map[args.name]) + local_version = read_version_of_local_package(local_version_file) + else: + raise ValueError(f"package<{args.name}> not supported") should_deploy = str(parse_version(remote_version) < parse_version(local_version)).lower() print(f"should_deploy={should_deploy}")