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

haonan pushed a commit to branch try_fix_python
in repository https://gitbox.apache.org/repos/asf/tsfile.git

commit 88f60da75a14c5e3437b4e33ac78ee9935afe5ee
Author: HTHou <[email protected]>
AuthorDate: Tue Aug 6 16:20:18 2024 +0800

    better code
---
 python/setup.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/python/setup.py b/python/setup.py
index 82aabb74..bdffcb3d 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -76,6 +76,15 @@ source_include_dir = os.path.join(
 target_include_dir = os.path.join(project_dir, "tsfile", "TsFile-cwrapper.h")
 copy_header(source_include_dir, target_include_dir)
 
+system = platform.system()
+is_windows = system == "Windows"
+
+compile_args = ["-std=c++11"]
+if is_windows:
+    compile_args.append("-DMS_WIN64")
+
+runtime_library_dirs = [libtsfile_dir] if not is_windows else None
+
 ext_modules_tsfile = [
     Extension(
         "tsfile.tsfile_pywrapper",
@@ -83,14 +92,8 @@ ext_modules_tsfile = [
         libraries=["tsfile"],
         library_dirs=[libtsfile_dir],
         include_dirs=[include_dir, np.get_include()],
-        runtime_library_dirs=(
-            [libtsfile_dir] if platform.system() != "Windows" else None
-        ),
-        extra_compile_args=(
-            ["-std=c++11"]
-            if platform.system() != "Windows"
-            else ["-std=c++11", "-DMS_WIN64"]
-        ),
+        runtime_library_dirs=runtime_library_dirs,
+        extra_compile_args=compile_args,
         language="c++",
     )
 ]

Reply via email to