hiredis-py icon indicating copy to clipboard operation
hiredis-py copied to clipboard

Allow to use platform hiredis libs on build.

Open tuxmaster5000 opened this issue 6 years ago • 4 comments

At the build stage, the internal hiredis lib are used. But on Linux the hiredis C lib are available, so in many cases it will be better to use the system one.

tuxmaster5000 avatar Oct 17 '19 10:10 tuxmaster5000

By vendoring hiredis it's possible to work against a specific version, right down to a single commit.

I don't know if there are other reasons hiredis is vendored, specific to ruby, but that's my guess.

Edit: Python, not ruby. There are too many hiredis wrappers!

michael-grunder avatar Oct 17 '19 17:10 michael-grunder

I think this be controlled by an build setting like "use_system_hiredis=false" by default. So it will not break anything.

tuxmaster5000 avatar Oct 18 '19 10:10 tuxmaster5000

diff --git a/setup.py b/setup.py
index bc8a95c..c28dd94 100755
--- a/setup.py
+++ b/setup.py
@@ -11,9 +11,8 @@ def version():
   return module.__version__
 
 ext = Extension("hiredis.hiredis",
-  sources=sorted(glob.glob("src/*.c") +
-                 ["vendor/hiredis/%s.c" % src for src in ("read", "sds")]),
-  include_dirs=["vendor"])
+  sources=sorted(glob.glob("src/*.c")),
+  libraries=['hiredis'])
 
 setup(
   name="hiredis",

It's easy, until you have to deal with API breaking changes.

ifduyue avatar Oct 22 '19 04:10 ifduyue