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 ix/log/gnu/packages/telegram.scm?id=31a1e7d375cd554149bac83e5acaaf0ef63b65b6&showmsg=1'>Expand)Author 2024-09-27gnu: telegram-desktop: Use xdg-desktop-portal-next....* gnu/packages/telegram.scm (telegram-desktop) [native-inputs]: Replace xdg-desktop-portal with xdg-desktop-portal-next. Change-Id: Icd0bc0d731e0ece576b590f34960d55f79ef4b43 Maxim Cournoyer 2024-09-26gnu: telegraph-desktop: Fix exhuberant build memory requirements....From 25 GiB to 1.3 GiB. * gnu/packages/telegram.scm (telegram-desktop) [configure-flags]: Specify the 'Release' build type. Change-Id: I040d79d341412d43e864c95b315c1c8ad5fd19ae Maxim Cournoyer 2024-09-26gnu: telegram-desktop: Update to 5.5.5....* gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch: Update patch file to match upstream changes. * gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch: Update patch file to match upstream changes. * gnu/packages/patches/telegram-desktop-unbundle-cppgir.patch: New file. * gnu/packages/patches/telegram-desktop-unbundle-gsl.patch: New file. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/telegram.scm: (libyuv-for-telegram-desktop, cmake-helpers-for-telegram-desktop) (codegen-for-telegram-desktop, lib-base-for-telegram-desktop) (lib-crl-for-telegram-desktop, lib-lottie-for-telegram-desktop) (lib-qr-for-telegram-desktop, lib-storage-for-telegram-desktop) (lib-tl-for-telegram-desktop, lib-webrtc-for-telegram-desktop) (tgcalls-for-telegram-desktop, webrtc-for-telegram-desktop): Bump to submodule checkout. (cmake-helpers-for-telegram-desktop)[origin]: Add patches to unbundle gsl and cppgir. (libprisma-for-telegram-desktop): Use %telegram-version. (telegram-desktop): Update to 5.5.5. [:configure-flags]: Add disable jemalloc flag. [#:phases]<unpack-additional-sources>: Add libprisma-for-telegram-desktop. <patch-gir-ignore-paths>: New phase. <use-system-xdg-desktop-portal>: New phase. <patch-libwebview>: New phase. [native-inputs]: Add cpp-ada-url-parser, gobject-introspection and xdg-desktop-portal. [inputs]: Add boost, cppgir-for-telegram-desktop, expected-lite and remove jemalloc. Change-Id: I0ea3ea5a3e416a9d5b2b5b7b55ca1af679bc3d38 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> dan 2024-09-26gnu: Add libprisma-for-telegram-desktop....* gnu/packages/telegram.scm (libprisma-for-telegram-desktop): New variable. Change-Id: I855b463993654a8cad491c7b56c9581b3083f5e4 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> dan 2024-08-31build-systems: gnu: Export %default-gnu-imported-modules and %default-gnu-mod......Until now users would have to cargo cult or inspect the private %default-modules variable of (guix build-systems gnu) to discover which modules to include when extending the used modules via the #:modules argument. The renaming was automated via the command: $ git grep -l %gnu-build-system-modules | xargs sed 's/%gnu-build-system-modules/%default-gnu-imported-modules/' -i * guix/build-system/gnu.scm (%gnu-build-system-modules): Rename to... (%default-gnu-imported-modules): ... this. (%default-modules): Rename to... (%default-gnu-modules): ... this. Export. (dist-package, gnu-build, gnu-cross-build): Adjust accordingly. Change-Id: Idef307fff13cb76f3182d782b26e1cd3a5c757ee Maxim Cournoyer