From 097284e77f0e405bc7b4d23b509aae3db9daa27a Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Tue, 15 Feb 2022 14:45:10 -0500 Subject: [PATCH] Add env var to control stripping debug info (#507) Before this commit, debug info is stripped unconditionally on Linux. This commit adds an environment variable `UJSON_BUILD_NO_STRIP` that disables this behavior. This is helpful for distribution packagers who would otherwise have to patch `setup.py` to prevent stripping. --- setup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 453dc317..3a6c581e 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,19 @@ import platform from glob import glob +from os import environ from setuptools import Extension, setup dconv_source_files = glob("./deps/double-conversion/double-conversion/*.cc") dconv_source_files.append("./lib/dconv_wrapper.cc") -strip_flags = ["-Wl,--strip-all"] if platform.system() == "Linux" else [] +if platform.system() == "Linux" and environ.get("UJSON_BUILD_NO_STRIP", "0") not in ( + "1", + "True", +): + strip_flags = ["-Wl,--strip-all"] +else: + strip_flags = [] module1 = Extension( "ujson",