Skip to content

Commit 05dde6a

Browse files
authored
chore: delete unused code in scripts (#6084)
fix: delete unused code in scripts Signed-off-by: yihong0618 <[email protected]>
1 parent 5232691 commit 05dde6a

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

scripts/constants.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# under the License.
1818

1919
from pathlib import Path
20-
import tomllib
2120

2221
ROOT_DIR = Path(__file__).parent.parent
2322

@@ -36,45 +35,3 @@ def list_packages():
3635

3736

3837
PACKAGES = list_packages()
39-
40-
# package dependencies is used to maintain the dependencies between packages.
41-
#
42-
# All packages are depend on `core` by default, so we should only maintain the exceptions in list.
43-
PACKAGE_DEPENDENCIES = {
44-
Path("bindings/go"): "bindings/c",
45-
Path("bindings/swift"): "bindings/c",
46-
Path("bindings/zig"): "bindings/c",
47-
}
48-
49-
50-
# fetch the package dependence, return `core` if not listed in `PACKAGE_DEPENDENCIES`.
51-
def get_package_dependence(package: Path) -> str:
52-
return PACKAGE_DEPENDENCIES.get(package, "core")
53-
54-
55-
# input: Path to a Rust package like `core` and `bindings/python`.
56-
def get_rust_package_version(path):
57-
with open(ROOT_DIR / path / "Cargo.toml", "rb") as f:
58-
data = tomllib.load(f)
59-
version = data["package"]["version"]
60-
return version
61-
62-
63-
# get the package version by package name.
64-
#
65-
# For examples:
66-
# core: `0.45.0`
67-
# packages depends on core: `0.1.0`
68-
def get_package_version(package):
69-
if package == "core":
70-
return get_rust_package_version("core")
71-
72-
cargo_toml = ROOT_DIR / package / "Cargo.toml"
73-
# cargo_toml exists, we can get the version from Cargo.toml.
74-
if cargo_toml.exists():
75-
return get_rust_package_version(package)
76-
77-
# cargo_toml not exists, we should handle case by case ideally.
78-
#
79-
# However, those packages are not mature enough, it's much easier for us to always return `0.0.0` instead.
80-
return "0.0.0"

0 commit comments

Comments
 (0)