Skip to content

Commit 917cecd

Browse files
committed
fix: resolved python lint issues
1 parent 64b7d8d commit 917cecd

3 files changed

Lines changed: 39 additions & 32 deletions

File tree

components/core/tools/scripts/utils/build-and-run-unit-tests.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def main(argv: List[str]) -> int:
4545
help="Build targets by linking against shared libraries.",
4646
)
4747
args_parser.add_argument(
48-
"--num-jobs", type=int, default=os.cpu_count(), help="Max number of jobs to run when building."
48+
"--num-jobs",
49+
type=int,
50+
default=os.cpu_count(),
51+
help="Max number of jobs to run when building.",
4952
)
5053
args_parser.add_argument("--test-spec", help="Catch2 test specification.")
5154

@@ -54,9 +57,12 @@ def main(argv: List[str]) -> int:
5457
test_spec: Optional[str] = parsed_args.test_spec
5558

5659
build_cmd = [
57-
"python3", "build.py",
58-
"--build-dir", str(build_dir),
59-
"--num-jobs", str(parsed_args.num_jobs)
60+
"python3",
61+
"build.py",
62+
"--build-dir",
63+
str(build_dir),
64+
"--num-jobs",
65+
str(parsed_args.num_jobs),
6066
]
6167
if parsed_args.use_shared_libs:
6268
build_cmd.append("--use-shared-libs")

components/core/tools/scripts/utils/build-with-docker.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
PLATFORM_CONFIGS = {
3030
"linux/amd64": {
3131
"build_script": "clp-env-base-manylinux_2_28_x86_64/build.sh",
32-
"docker_image": "clp-core-dependencies-manylinux_2_28_x86_64"
32+
"docker_image": "clp-core-dependencies-manylinux_2_28_x86_64",
3333
},
3434
"linux/arm64": {
3535
"build_script": "clp-env-base-manylinux_2_28_aarch64/build.sh",
36-
"docker_image": "clp-core-dependencies-manylinux_2_28_aarch64"
37-
}
36+
"docker_image": "clp-core-dependencies-manylinux_2_28_aarch64",
37+
},
3838
}
3939

4040

@@ -63,9 +63,7 @@ def _find_project_root() -> Path:
6363

6464

6565
def _build_clp_manylinux_2_28_binaries(
66-
output_path: Path,
67-
target_platform: str,
68-
use_shared_libs: bool = False
66+
output_path: Path, target_platform: str, use_shared_libs: bool = False
6967
) -> None:
7068
"""
7169
Builds the CLP-core binaries for the specified target platform
@@ -80,14 +78,21 @@ def _build_clp_manylinux_2_28_binaries(
8078
build_script = Path("/clp/components/core/tools/scripts/utils/build.py")
8179

8280
cmd = [
83-
"docker", "run",
84-
"--user", f"{os.getuid()}:{os.getgid()}",
85-
"--platform", target_platform,
86-
"-v", f"{project_root}:/clp",
87-
"-v", f"{output_path}:/output",
81+
"docker",
82+
"run",
83+
"--user",
84+
f"{os.getuid()}:{os.getgid()}",
85+
"--platform",
86+
target_platform,
87+
"-v",
88+
f"{project_root}:/clp",
89+
"-v",
90+
f"{output_path}:/output",
8891
f"{config['docker_image']}:dev",
89-
"python3", str(build_script),
90-
"--build-dir", "/output"
92+
"python3",
93+
str(build_script),
94+
"--build-dir",
95+
"/output",
9196
]
9297
if use_shared_libs:
9398
cmd.append("--use-shared-libs")
@@ -101,24 +106,20 @@ def _build_clp_manylinux_2_28_binaries(
101106

102107

103108
def main(argv: List[str]) -> int:
104-
args_parser = argparse.ArgumentParser(
105-
description="Builds the CLP-core's binaries"
106-
)
109+
args_parser = argparse.ArgumentParser(description="Builds the CLP-core's binaries")
107110
args_parser.add_argument(
108-
"--output-dir",
109-
required=True,
110-
help="Directory to put the compiled CLP-core binaries in."
111+
"--output-dir", required=True, help="Directory to put the compiled CLP-core binaries in."
111112
)
112113
args_parser.add_argument(
113114
"--use-shared-libs",
114115
action="store_true",
115-
help="Build targets by linking against shared libraries."
116+
help="Build targets by linking against shared libraries.",
116117
)
117118
args_parser.add_argument(
118119
"--target-platform",
119120
default="linux/amd64",
120121
choices=["linux/amd64", "linux/arm64"],
121-
help="Target platform of the compiled binary: linux/amd64 or linux/arm64"
122+
help="Target platform of the compiled binary: linux/amd64 or linux/arm64",
122123
)
123124

124125
parsed_args = args_parser.parse_args(argv[1:])
@@ -130,9 +131,7 @@ def main(argv: List[str]) -> int:
130131

131132
_build_clp_env_base_image(parsed_args.target_platform)
132133
_build_clp_manylinux_2_28_binaries(
133-
output_dir,
134-
parsed_args.target_platform,
135-
parsed_args.use_shared_libs
134+
output_dir, parsed_args.target_platform, parsed_args.use_shared_libs
136135
)
137136

138137
logger.info("Build process completed successfully.")

components/core/tools/scripts/utils/build.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pathlib import Path
77
from typing import List, Optional
88

9-
109
# Set up console logging
1110
logging_console_handler = logging.StreamHandler()
1211
logging_formatter = logging.Formatter(
@@ -25,6 +24,7 @@
2524
# Number of parent directories to reach project root from this script
2625
PROJECT_ROOT_DEPTH = 6
2726

27+
2828
def _run_subprocess(cmd: List[str], cwd: Optional[Path] = None) -> None:
2929
logger.info(f"Running: {' '.join(cmd)} in {cwd if cwd else Path.cwd()}")
3030
try:
@@ -37,8 +37,10 @@ def _run_subprocess(cmd: List[str], cwd: Optional[Path] = None) -> None:
3737
def _config_cmake_project(src_dir: Path, build_dir: Path, use_shared_libs: bool):
3838
cmd = [
3939
"cmake",
40-
"-S", str(src_dir),
41-
"-B", str(build_dir),
40+
"-S",
41+
str(src_dir),
42+
"-B",
43+
str(build_dir),
4244
]
4345
if use_shared_libs:
4446
cmd.append("-DCLP_USE_STATIC_LIBS=OFF")
@@ -82,7 +84,7 @@ def main(argv: List[str]) -> int:
8284
"--num-jobs",
8385
type=int,
8486
default=os.cpu_count(),
85-
help="Max number of jobs to run when building."
87+
help="Max number of jobs to run when building.",
8688
)
8789

8890
parsed_args = args_parser.parse_args(argv[1:])

0 commit comments

Comments
 (0)