From 7c917c8d64f3da3d1d1c3b715d4953736f9ce5fa Mon Sep 17 00:00:00 2001 From: yousukseung <85715732+yousukseung@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:14:22 +0000 Subject: [PATCH] Automated change: Fix sanity tests --- src/python/grpcio_sleuth/grpc_sleuth/BUILD.bazel | 2 +- .../grpcio_sleuth/grpc_sleuth/sleuth_cli.py | 4 +++- .../grpcio_sleuth/grpc_sleuth/sleuth_lib.pyx | 1 + src/python/grpcio_sleuth/setup.py | 16 +++++++++------- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/python/grpcio_sleuth/grpc_sleuth/BUILD.bazel b/src/python/grpcio_sleuth/grpc_sleuth/BUILD.bazel index 5f72163d974e1..f0de22a14c766 100644 --- a/src/python/grpcio_sleuth/grpc_sleuth/BUILD.bazel +++ b/src/python/grpcio_sleuth/grpc_sleuth/BUILD.bazel @@ -19,7 +19,7 @@ pyx_library( name = "sleuth_lib_pyx", srcs = ["sleuth_lib.pyx"], cc_deps = [ - "//test/cpp/sleuth:sleuth", + "//test/cpp/sleuth", ], ) diff --git a/src/python/grpcio_sleuth/grpc_sleuth/sleuth_cli.py b/src/python/grpcio_sleuth/grpc_sleuth/sleuth_cli.py index 43e1dca52a416..2116ff636ac20 100644 --- a/src/python/grpcio_sleuth/grpc_sleuth/sleuth_cli.py +++ b/src/python/grpcio_sleuth/grpc_sleuth/sleuth_cli.py @@ -15,14 +15,16 @@ """CLI entry point for gRPC Sleuth.""" import sys + from . import sleuth_lib + def main(): """Main function for the sleuth CLI.""" # sys.argv[0] is the script name, so pass the rest. exit_code = sleuth_lib.run_sleuth(sys.argv[1:]) sys.exit(exit_code) + if __name__ == "__main__": main() - diff --git a/src/python/grpcio_sleuth/grpc_sleuth/sleuth_lib.pyx b/src/python/grpcio_sleuth/grpc_sleuth/sleuth_lib.pyx index 44853221dbae6..6eed858a41ea0 100644 --- a/src/python/grpcio_sleuth/grpc_sleuth/sleuth_lib.pyx +++ b/src/python/grpcio_sleuth/grpc_sleuth/sleuth_lib.pyx @@ -15,6 +15,7 @@ from libcpp.string cimport string from libcpp.vector cimport vector + cdef extern from "../../../test/cpp/sleuth/sleuth.h" namespace "grpc_sleuth": cdef int RunSleuth_Wrapper "grpc_sleuth::RunSleuth_Wrapper"( vector[string] args, void* python_print, diff --git a/src/python/grpcio_sleuth/setup.py b/src/python/grpcio_sleuth/setup.py index 8c94ac408d4af..5024545281f82 100644 --- a/src/python/grpcio_sleuth/setup.py +++ b/src/python/grpcio_sleuth/setup.py @@ -18,13 +18,13 @@ import subprocess import sys +import python_version import setuptools from setuptools import Extension from setuptools.command.build_ext import build_ext # Break import-style to ensure we can actually find our local modules. import grpc_version -import python_version _PACKAGE_PATH = os.path.realpath(os.path.dirname(__file__)) _README_PATH = os.path.join(_PACKAGE_PATH, "README.rst") @@ -67,7 +67,9 @@ def run(self): # This makes the .so available during the extension build process. build_lib_dest_dir = os.path.join(self.build_lib, "grpc_sleuth", "lib") os.makedirs(build_lib_dest_dir, exist_ok=True) - shutil.copy(_SLEUTH_SO_SRC, os.path.join(build_lib_dest_dir, "libsleuth.so")) + shutil.copy( + _SLEUTH_SO_SRC, os.path.join(build_lib_dest_dir, "libsleuth.so") + ) # Add the library directory for the current build to find libsleuth.so during extension linking for ext in self.extensions: @@ -105,7 +107,7 @@ def run(self): language="c++", extra_compile_args=["-std=c++17"], libraries=["sleuth"], - runtime_library_dirs=["$ORIGIN/lib"] + runtime_library_dirs=["$ORIGIN/lib"], ) ] @@ -126,13 +128,13 @@ def run(self): setup_requires=SETUP_REQUIRES, ext_modules=extensions, cmdclass={ - 'build_ext': custom_build_ext, + "build_ext": custom_build_ext, }, entry_points={ - 'console_scripts': [ - 'grpc_sleuth=grpc_sleuth.sleuth_cli:main', + "console_scripts": [ + "grpc_sleuth=grpc_sleuth.sleuth_cli:main", ], }, - package_data={'grpc_sleuth': ['lib/*.so']}, + package_data={"grpc_sleuth": ["lib/*.so"]}, include_package_data=True, )