Skip to content

Commit 82d9888

Browse files
committed
update something
1 parent 2210d84 commit 82d9888

File tree

2 files changed

+40
-41
lines changed

2 files changed

+40
-41
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ requires = ["hatchling", "hatch-fancy-pypi-readme"]
1919
build-backend = "hatchling.build"
2020

2121
[project]
22-
name="dubbo-python"
22+
name="apache-dubbo"
2323
requires-python = ">=3.9"
2424
authors = [
2525
{name = "Apache Dubbo Community", email = "[email protected]"}
@@ -30,7 +30,7 @@ maintainers = [
3030
description = "Python Implementation For Apache Dubbo."
3131
license = "Apache-2.0"
3232
license-files = ["LICEN[CS]E.*"]
33-
keywords=["dubbo", "rpc","grpc", "dubbo-python", "http2", "network"]
33+
keywords=["dubbo", "rpc", "grpc", "dubbo-python", "http2", "network"]
3434
classifiers=[
3535
"Development Status :: 4 - Beta",
3636
"Intended Audience :: Developers",

scripts/rat.sh

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@
1717
# limitations under the License.
1818

1919
### Apache RAT license check script ###
20-
# This script downloads Apache RAT and runs it to check the license headers of the source files.
20+
set -e
2121

22-
set -e # Exit immediately if a command exits with a non-zero status.
23-
24-
# Some variables
2522
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
26-
TEMP_DIR="${ROOT_DIR}/temp"
23+
TMP_DIR="$(mktemp -d)"
24+
2725
RAT_VERSION="0.16.1"
28-
RAT_JAR="${TEMP_DIR}/apache-rat-${RAT_VERSION}.jar"
26+
RAT_JAR="${TMP_DIR}/apache-rat-${RAT_VERSION}.jar"
2927

3028

3129
cd "${ROOT_DIR}"
32-
mkdir -p "${TEMP_DIR}"
3330

3431
# Set Java command
3532
if [ -x "${JAVA_HOME}/bin/java" ]; then
@@ -39,48 +36,50 @@ else
3936
fi
4037

4138

42-
# Download Apache RAT jar file if not exists
43-
if [ ! -f "${RAT_JAR}" ]; then
44-
RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar"
45-
JAR_PART="${RAT_JAR}.part"
46-
47-
echo "Downloading Apache RAT ${RAT_VERSION}..."
39+
# Download Apache RAT jar
40+
RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar"
41+
JAR_PART="${RAT_JAR}.part"
4842

49-
if command -v curl &> /dev/null; then
50-
curl -L --silent "${RAT_URL}" -o "${JAR_PART}"
51-
elif command -v wget &> /dev/null; then
52-
wget --quiet "${RAT_URL}" -O "${JAR_PART}"
53-
else
54-
echo "Neither curl nor wget found."
55-
exit 1
56-
fi
43+
echo "Downloading Apache RAT ${RAT_VERSION}..."
5744

58-
mv "${JAR_PART}" "${RAT_JAR}"
5945

46+
if command -v curl &> /dev/null; then
47+
curl -L --silent "${RAT_URL}" -o "${JAR_PART}" && mv "${JAR_PART}" "${RAT_JAR}"
48+
elif command -v wget &> /dev/null; then
49+
wget --quiet "${RAT_URL}" -O "${JAR_PART}" && mv "${JAR_PART}" "${RAT_JAR}"
50+
else
51+
echo "Neither curl nor wget found."
52+
exit 1
53+
fi
6054

61-
# TODO: Strange phenomenon:its integrity cannot be verified, but it still works normally. (Ignore the check for now)
62-
# Check if the JAR file is valid
63-
# if ! unzip -tq "${RAT_JAR}" &> /dev/null; then
64-
# rm "${RAT_JAR}"
65-
# echo "Download ${RAT_JAR} failed or the file is not a valid JAR."
66-
# exit 1
67-
# fi
6855

69-
echo "Downloaded Apache RAT ${RAT_VERSION} successfully."
56+
# Check if the JAR file is valid
57+
unzip -tq "${RAT_JAR}" &> /dev/null
58+
if [ $? -ne 0 ]; then
59+
rm "${RAT_JAR}"
60+
echo "Download ${RAT_JAR} failed or the file is not a valid JAR."
61+
exit -1
7062
fi
7163

64+
echo "Downloaded Apache RAT ${RAT_VERSION} successfully."
65+
7266
# Run Apache RAT
7367
echo "Running Apache license check, this may take a while..."
7468

75-
"${java_cmd}" -jar "${RAT_JAR}" -E "${ROOT_DIR}/.license-ignore" -d "${ROOT_DIR}" > "${TEMP_DIR}/rat-report.txt"
69+
"${java_cmd}" -jar "${RAT_JAR}" -E "${ROOT_DIR}/.license-ignore" -d "${ROOT_DIR}" > "${TEMP_DIR}/rat-report.txt"
7670

77-
if grep -q "??" "${TEMP_DIR}/rat-report.txt"; then
78-
echo >&2 "Could not find Apache license headers in the following files:"
79-
grep "??" "${TEMP_DIR}/rat-report.txt" >&2
80-
exit 1
81-
else
82-
echo "Apache license check passed."
71+
if [ $? -ne 0 ]; then
72+
echo "RAT exited abnormally"
73+
exit 1
8374
fi
8475

85-
# Clean up
86-
rm -rf "${TEMP_DIR}"
76+
ERRORS="$(grep "??" "${TEMP_DIR}/rat-report.txt")"
77+
78+
79+
if [ -n "$ERRORS" ]; then
80+
echo "Could not find Apache license headers in the following files:"
81+
echo "$ERRORS"
82+
exit 1
83+
else
84+
echo "Apache license check passed."
85+
fi

0 commit comments

Comments
 (0)