You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/09/22 03:53:09 UTC

[inlong] branch master updated: [INLONG-5981][TubeMQ] Simplify the setup file for the TubeMQ Python client (#5982)

This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 823b91390 [INLONG-5981][TubeMQ] Simplify the setup file for the TubeMQ Python client (#5982)
823b91390 is described below

commit 823b91390936c900c5adf3d0dcc06ffd23c7d32b
Author: Charles Zhang <do...@apache.org>
AuthorDate: Thu Sep 22 11:53:05 2022 +0800

    [INLONG-5981][TubeMQ] Simplify the setup file for the TubeMQ Python client (#5982)
---
 .../tubemq-client-python/README.md                   | 10 +++++-----
 .../tubemq-client-python/setup.py                    | 20 +++++++++++++++-----
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/inlong-tubemq/tubemq-client-twins/tubemq-client-python/README.md b/inlong-tubemq/tubemq-client-twins/tubemq-client-python/README.md
index 3198638b7..673fe4615 100644
--- a/inlong-tubemq/tubemq-client-twins/tubemq-client-python/README.md
+++ b/inlong-tubemq/tubemq-client-twins/tubemq-client-python/README.md
@@ -7,9 +7,9 @@ TubeMQ Python Client library is a wrapper over the existing [C++ client library]
 
 build C++ client SDK from source, and install:
 
-1, copy `tubemq` include directory  to `/usr/local/include/`
+1, copy `include/tubemq` directory  to `/usr/local/include/`
 
-2, copy `libtubemq_rel.a` to `/usr/local/lib`
+2, copy `./release/tubemq/lib/libtubemq_rel.a` to `/usr/local/lib`
 &nbsp;
 
 - install python-devel
@@ -36,11 +36,11 @@ import time
 import tubemq
 
 topic_list = ['demo']
-master_addr = '127.0.0.1:8000'
-group_name = 'test_group'
+MASTER_ADDR = '127.0.0.1:8000'
+GROUP_NAME = 'test_group'
 
 # Start consumer
-consumer = tubemq.consumer(master_addr, group_name, topic_list)
+consumer = tubemq.Consumer(MASTER_ADDR, GROUP_NAME, topic_list)
 
 # Test consumer
 start_time = time.time()
diff --git a/inlong-tubemq/tubemq-client-twins/tubemq-client-python/setup.py b/inlong-tubemq/tubemq-client-twins/tubemq-client-python/setup.py
index cce07f39a..1da9e032a 100644
--- a/inlong-tubemq/tubemq-client-twins/tubemq-client-python/setup.py
+++ b/inlong-tubemq/tubemq-client-twins/tubemq-client-python/setup.py
@@ -30,35 +30,45 @@ __version__ = "0.0.1"
 # include_dirs=["/usr/local/include/"], runtime_library_dirs=["/usr/local/lib"],
 # yum install python-devel
 
+extra_link_args = ["-ltubemq", "-ltubemq_proto", "-Wl,-Bstatic",
+    "-lprotobuf", "-Wl,-Bdynamic", "-llog4cplus", "-lssl",
+    "-lcrypto", "-lpthread", "-lrt"]
+
 ext_modules = [
     Pybind11Extension("tubemq_client",
         sorted(glob("src/cpp/tubemq_client.cc")),
         cxx_std=11,
-        extra_link_args=["-ltubemq_rel", "-lssl", "-lcrypto", "-lpthread", "-lrt"],
+        extra_link_args=extra_link_args,
         define_macros=[('VERSION_INFO', __version__)],
         ),
     Pybind11Extension("tubemq_config",
                       sorted(glob("src/cpp/tubemq_config.cc")),
                       cxx_std=11,
-                      extra_link_args=["-ltubemq_rel", "-lssl", "-lcrypto", "-lpthread", "-lrt"],
+                      extra_link_args=extra_link_args,
                       define_macros=[('VERSION_INFO', __version__)],
                       ),
     Pybind11Extension("tubemq_errcode",
                       sorted(glob("src/cpp/tubemq_errcode.cc")),
                       cxx_std=11,
-                      extra_link_args=["-ltubemq_rel", "-lssl", "-lcrypto", "-lpthread", "-lrt"],
+                      extra_link_args=extra_link_args,
                       define_macros=[('VERSION_INFO', __version__)],
                       ),
     Pybind11Extension("tubemq_message",
                       sorted(glob("src/cpp/tubemq_message.cc")),
                       cxx_std=11,
-                      extra_link_args=["-ltubemq_rel", "-lssl", "-lcrypto", "-lpthread", "-lrt"],
+                      extra_link_args=extra_link_args,
                       define_macros=[('VERSION_INFO', __version__)],
                       ),
     Pybind11Extension("tubemq_return",
                       sorted(glob("src/cpp/tubemq_return.cc")),
                       cxx_std=11,
-                      extra_link_args=["-ltubemq_rel", "-lssl", "-lcrypto", "-lpthread", "-lrt"],
+                      extra_link_args=extra_link_args,
+                      define_macros=[('VERSION_INFO', __version__)],
+                      ),
+    Pybind11Extension("tubemq_tdmsg",
+                      sorted(glob("src/cpp/tubemq_tdmsg.cc")),
+                      cxx_std=11,
+                      extra_link_args=extra_link_args + ["-lsnappy"],
                       define_macros=[('VERSION_INFO', __version__)],
                       )
 ]