Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/grpcio_sleuth/grpc_sleuth/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pyx_library(
name = "sleuth_lib_pyx",
srcs = ["sleuth_lib.pyx"],
cc_deps = [
"//test/cpp/sleuth:sleuth",
"//test/cpp/sleuth",
],
)

Expand Down
4 changes: 3 additions & 1 deletion src/python/grpcio_sleuth/grpc_sleuth/sleuth_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

1 change: 1 addition & 0 deletions src/python/grpcio_sleuth/grpc_sleuth/sleuth_lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 9 additions & 7 deletions src/python/grpcio_sleuth/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"],
)
]

Expand All @@ -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,
)