redis / hiredis-py

Python wrapper for hiredis
MIT License
494 stars 102 forks source link

Allow to use platform hiredis libs on build. #90

Open tuxmaster5000 opened 4 years ago

tuxmaster5000 commented 4 years ago

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.

michael-grunder commented 4 years ago

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!

tuxmaster5000 commented 4 years ago

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

ifduyue commented 4 years ago
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.