Skip to content

Commit

Permalink
Unify the version in GraphScope by link VERSION file (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidongze0629 authored Dec 17, 2021
1 parent 2201c36 commit 53df412
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 108 deletions.
14 changes: 3 additions & 11 deletions analytical_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.1)

if ("${GRAPHSCOPE_VERSION}" STREQUAL "")
set(GRAPHSCOPE_ANALYTICAL_MAJOR_VERSION 0)
set(GRAPHSCOPE_ANALYTICAL_MINOR_VERSION 9)
set(GRAPHSCOPE_ANALYTICAL_PATCH_VERSION 0)
set(GRAPHSCOPE_ANALYTICAL_VERSION ${GRAPHSCOPE_ANALYTICAL_MAJOR_VERSION}.${GRAPHSCOPE_ANALYTICAL_MINOR_VERSION}.${GRAPHSCOPE_ANALYTICAL_PATCH_VERSION})
else ()
set(GRAPHSCOPE_ANALYTICAL_MAJOR_VERSION ${GRAPHSCOPE_MAJOR_VERSION})
set(GRAPHSCOPE_ANALYTICAL_MINOR_VERSION ${GRAPHSCOPE_MINOR_VERSION})
set(GRAPHSCOPE_ANALYTICAL_PATCH_VERSION ${GRAPHSCOPE_PATCH_VERSION})
set(GRAPHSCOPE_ANALYTICAL_VERSION ${GRAPHSCOPE_VERSION})
endif ()
file(READ VERSION GRAPHSCOPE_ANALYTICAL_VERSION)
# Strip trailing newline
string(REGEX REPLACE "\n$" "" GRAPHSCOPE_ANALYTICAL_VERSION "${GRAPHSCOPE_ANALYTICAL_VERSION}")

if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
Expand Down
1 change: 1 addition & 0 deletions analytical_engine/VERSION
1 change: 1 addition & 0 deletions coordinator/gscoordinator/VERSION
14 changes: 4 additions & 10 deletions coordinator/gscoordinator/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@

import os

version_file_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "..", "VERSION"
)
version_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")

if os.path.isfile(version_file_path):
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))
else:
__version__ = "0.9.0"
__version_tuple__ = (0, 9, 0)
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))

del version_file_path
42 changes: 3 additions & 39 deletions coordinator/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,15 @@ def parsed_packages():
return ["foo"]


def parsed_packge_data():
def parsed_package_data():
name = os.environ.get("package_name", "gs-coordinator")
if name == "gs-coordinator":
return {
"gscoordinator": [
"builtin/app/builtin_app.gar",
"builtin/app/*.yaml",
"template/*.template",
"VERSION",
],
}
return {}
Expand Down Expand Up @@ -361,41 +362,6 @@ def parse_version(root, **kwargs):
return parse(root, **kwargs)


version_template = """#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
import os
version_file_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "..", "VERSION"
)
if os.path.isfile(version_file_path):
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))
else:
__version__ = "{version}"
__version_tuple__ = {version_tuple}
del version_file_path
"""


setup(
name=os.environ.get("package_name", "gs-coordinator"),
description="",
Expand Down Expand Up @@ -425,13 +391,11 @@ def parse_version(root, **kwargs):
use_scm_version={
"root": repo_root,
"parse": parse_version,
"write_to": os.path.join(repo_root, "gscoordinator/version.py"),
"write_to_template": version_template,
},
setup_requires=["setuptools_scm>=5.0.0", "grpcio", "grpcio-tools"],
package_dir=parsed_package_dir(),
packages=parsed_packages(),
package_data=parsed_packge_data(),
package_data=parsed_package_data(),
cmdclass={
"build_builtin": BuildBuiltin,
"build_py": CustomBuildPy,
Expand Down
2 changes: 1 addition & 1 deletion k8s/jupyter.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ WORKDIR /home/graphscope
ENV PATH=${PATH}:/home/graphscope/.local/bin

RUN python3 -m pip install --upgrade pip --user
RUN python3 -m pip install jupyterlab graphscope-client==0.9.0 --user
RUN python3 -m pip install jupyterlab graphscope-client -U --user

CMD ["jupyter", "lab", "--port=8888", "--no-browser", "--ip=0.0.0.0"]
1 change: 1 addition & 0 deletions python/graphscope/VERSION
14 changes: 4 additions & 10 deletions python/graphscope/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@

import os

version_file_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "..", "VERSION"
)
version_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")

if os.path.isfile(version_file_path):
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))
else:
__version__ = "0.9.0"
__version_tuple__ = (0, 9, 0)
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))

del version_file_path
46 changes: 9 additions & 37 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ def resolve_graphscope_package_dir():
return package_dir


def parsed_packge_data():
return {
"graphscope": [
"VERSION",
],
}


def build_learning_engine():
import numpy

Expand Down Expand Up @@ -235,41 +243,6 @@ def parse_version(root, **kwargs):
return parse(root, **kwargs)


version_template = """#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
import os
version_file_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "..", "VERSION"
)
if os.path.isfile(version_file_path):
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))
else:
__version__ = "{version}"
__version_tuple__ = {version_tuple}
del version_file_path
"""


setup(
name="graphscope-client",
description="GraphScope: A One-Stop Large-Scale Graph Computing System from Alibaba",
Expand Down Expand Up @@ -299,12 +272,11 @@ def parse_version(root, **kwargs):
use_scm_version={
"root": repo_root,
"parse": parse_version,
"write_to": os.path.join(repo_root, "graphscope/version.py"),
"write_to_template": version_template,
},
setup_requires=["setuptools_scm>=5.0.0", "grpcio", "grpcio-tools"],
package_dir=resolve_graphscope_package_dir(),
packages=find_graphscope_packages(),
package_data=parsed_packge_data(),
ext_modules=build_learning_engine(),
cmdclass={
"build_ext": CustomBuildExt,
Expand Down

0 comments on commit 53df412

Please sign in to comment.