Upstream status: https://github.com/redis/hiredis-py/pull/161 From 7b3c8a364f6167f4b1828dd9c48ada3d8b0786f6 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sat, 18 Mar 2023 21:32:21 -0400 Subject: [PATCH] setup.py: Fallback to use the system hiredis library. Fixes #158 fully, including using a system-prodived hiredis. When the hiredis git submodule hasn't been initialized, print a message about it, and attempt to link against the a system-provided hiredis library instead. * setup.py (is_hiredis_bundled): New procedure. (get_hiredis_bundled_sources): Likewise. Print a message when bundled_hiredis_sources is empty. (get_sources): Adjust to use the above procedure. (get_linker_args): Add -lhiredis when the bundled hiredis is not used. --- setup.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 905df59..a77aca3 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,7 @@ except ImportError: import importlib import glob import io +import os import sys @@ -17,16 +18,39 @@ def version(): return module.__version__ +def is_hiredis_bundled(): + hiredis_submodule = 'vendor/hiredis' + if (os.path.exists(hiredis_submodule) + and not os.path.isfile(hiredis_submodule)): + return not os.listdir() + return False + + +def get_hiredis_bundled_sources(): + hiredis_sources = ("alloc", "async", "hiredis", "net", "read", + "sds", "sockcompat") + if is_hiredis_bundled(): + return ["vendor/hiredis/%s.c" % src for src in hiredis_sources] + return [] + + +if not is_hiredis_bundled(): + print('the bundled hiredis sources were not found;' + ' system hiredis will be used\n' + 'to use the bundled hiredis sources instead,' + ' run "git submodule update --init"') + + def get_sources(): - hiredis_sources = ("alloc", "async", "hiredis", "net", "read", "sds", "sockcompat") - return sorted(glob.glob("src/*.c") + ["vendor/hiredis/%s.c" % src for src in hiredis_sources]) + return sorted(glob.glob("src/*.c") + get_hiredis_bundled_sources()) def get_linker_args(): if 'win32' in sys.platform or 'darwin' in sys.platform: return [] else: - return ["-Wl,-Bsymbolic", ] + return ["-Wl,-Bsymbolic", ] + \ + ['-lhiredis'] if not is_hiredis_bundled() else [] def get_compiler_args(): base-commit: 8adb1b3cb38b82cdc73fa2d72879712da1f74e70 -- 2.39.1 p;showmsg=1'>Expand)Author 2022-08-28tests: Add test for menu-entry roundtrips as sexps....* tests/boot-parameters.scm (%uuid-menu-entry, %file-system-label-menu-entry): New variables. ("menu-entry roundtrip, uuid", "menu-entry roundtrip, file-system-label"): New tests. Signed-off-by: Marius Bakke <marius@gnu.org> Josselin Poiret 2022-03-16system: Improve 'read-boot-parameters' incompatibility diagnostic....Previously, when reading an incompatible "parameters" file, 'guix system' would print a warning and then crash with a wrong-type-arg backtrace because code expects 'read-boot-parameters' to always return a <boot-parameters> record. * gnu/system.scm (read-boot-parameters): Upon incompatibility, raise an error instead of returning #f. Also raise a '&fix-hint' condition. * tests/boot-parameters.scm ("read, construction, mandatory fields"): Define 'test-read-boot-parameters' as a macro; expect 'formatted-message?' exceptions rather than #f returns. Ludovic Courtès 2022-03-01system: Add a version field to the <boot-parameters> record....This version field exposes the (already present) version information of a boot parameters file. * gnu/system.scm (%boot-parameters-version): New variable. (<boot-parameters>)[version]: New field. (read-boot-parameters): Use it. (operating-system-boot-parameters-file): Likewise. * tests/boot-parameters.scm (test-read-boot-parameters): Use %boot-parameters-version as the default version value in the template. Maxim Cournoyer 2021-08-29Migrate to the new 'targets' field of bootloader-configuration....The old 'target' field is deprecated; adjust the sources to use the new 'targets' one instead. * doc/guix-cookbook.texi<target>: Replace by 'targets'. * gnu/bootloader/grub.scm: Likewise. * gnu/installer/parted.scm: Likewise. * gnu/machine/digital-ocean.scm: Likewise. * gnu/system/examples/asus-c201.tmpl: Likewise * gnu/system/examples/bare-bones.tmpl: Likewise * gnu/system/examples/bare-hurd.tmpl: Likewise * gnu/system/examples/beaglebone-black.tmpl: Likewise * gnu/system/examples/desktop.tmpl: Likewise * gnu/system/examples/docker-image.tmpl: Likewise * gnu/system/examples/lightweight-desktop.tmpl: Likewise * gnu/system/examples/vm-image.tmpl: Likewise * gnu/system/examples/yggdrasil.tmpl: Likewise * gnu/system/hurd.scm: Likewise * gnu/system/images/hurd.scm: Likewise * gnu/system/images/novena.scm: Likewise * gnu/system/images/pine64.scm: Likewise * gnu/system/images/pinebook-pro.scm: Likewise * gnu/system/images/rock64.scm: Likewise * gnu/system/install.scm: Likewise * gnu/system/vm.scm: Likewise * gnu/tests.scm: Likewise * gnu/tests/ganeti.scm: Likewise * gnu/tests/install.scm: Likewise * gnu/tests/nfs.scm: Likewise * gnu/tests/telephony.scm: Likewise * tests/boot-parameters.scm: Likewise * tests/system.scm: Likewise Maxim Cournoyer