You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "diqiu50 (via GitHub)" <gi...@apache.org> on 2024/08/27 06:14:49 UTC
[PR] [#4695] fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
diqiu50 opened a new pull request, #4700:
URL: https://github.com/apache/gravitino/pull/4700
### What changes were proposed in this pull request?
Fix gradlew :clients:client-python:build failed if the package does not contain .git directory
### Why are the changes needed?
Fix: #4695
### Does this PR introduce _any_ user-facing change?
NO
### How was this patch tested?
Manually test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao merged PR #4700:
URL: https://github.com/apache/gravitino/pull/4700
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #4700:
URL: https://github.com/apache/gravitino/pull/4700#discussion_r1732312066
##########
clients/client-python/scripts/generate_version.py:
##########
@@ -17,17 +17,36 @@
under the License.
"""
+# coding=utf-8
+
import re
import configparser
-import subprocess
from datetime import datetime
+from gravitino.constants.root import PROJECT_ROOT
from gravitino.constants.version import Version, VERSION_INI, SETUP_FILE
from gravitino.exceptions.base import GravitinoRuntimeException
VERSION_PATTERN = r"version\s*=\s*['\"]([^'\"]+)['\"]"
+def get_git_commit_id():
+ try:
+ commit_id = ""
+ git_path = f"{PROJECT_ROOT}/.git/"
+ with open(git_path + "HEAD", "r", encoding="utf-8") as file:
+ ref = file.readline().strip()
+
+ if ref.startswith("ref:"):
+ ref_path = ref.split(" ")[1]
+ with open(git_path + ref_path, "r", encoding="utf-8") as file:
+ commit_id = file.readline().strip()
+ return commit_id
+ except (FileNotFoundError, IOError) as e:
+ print(f"Warn: Failed to get git commit Id. {e}")
Review Comment:
I remove it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades commented on PR #4700:
URL: https://github.com/apache/gravitino/pull/4700#issuecomment-2311833489
plz fix the code style to make CI passed. @diqiu50
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on code in PR #4700:
URL: https://github.com/apache/gravitino/pull/4700#discussion_r1732302657
##########
clients/client-python/scripts/generate_version.py:
##########
@@ -17,17 +17,36 @@
under the License.
"""
+# coding=utf-8
+
import re
import configparser
-import subprocess
from datetime import datetime
+from gravitino.constants.root import PROJECT_ROOT
from gravitino.constants.version import Version, VERSION_INI, SETUP_FILE
from gravitino.exceptions.base import GravitinoRuntimeException
VERSION_PATTERN = r"version\s*=\s*['\"]([^'\"]+)['\"]"
+def get_git_commit_id():
+ try:
+ commit_id = ""
+ git_path = f"{PROJECT_ROOT}/.git/"
+ with open(git_path + "HEAD", "r", encoding="utf-8") as file:
+ ref = file.readline().strip()
+
+ if ref.startswith("ref:"):
+ ref_path = ref.split(" ")[1]
+ with open(git_path + ref_path, "r", encoding="utf-8") as file:
+ commit_id = file.readline().strip()
+ return commit_id
+ except (FileNotFoundError, IOError) as e:
+ print(f"Warn: Failed to get git commit Id. {e}")
Review Comment:
I think we should not use `print`, either we use log, or swallow the exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 closed pull request #4700: [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory
URL: https://github.com/apache/gravitino/pull/4700
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4695] Fix (python-client): Fix gradlew :clients:client-python:build failed if the package does not contain .git directory [gravitino]
Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on PR #4700:
URL: https://github.com/apache/gravitino/pull/4700#issuecomment-2311739606
LGTM, let wait the CI pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org