Skip to content

Commit

Permalink
fix version (#4226)
Browse files Browse the repository at this point in the history
  • Loading branch information
sijunhe authored Dec 23, 2022
1 parent 9124996 commit 918a545
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion paddlenlp/VERSION

This file was deleted.

4 changes: 1 addition & 3 deletions paddlenlp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions scripts/should_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}")

0 comments on commit 918a545

Please sign in to comment.