From 3b369674198407f95200ce73b24cc9b9d3b69636 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 14 Feb 2022 12:14:04 -0500 Subject: [PATCH 1/2] Add env var to control stripping debug info 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 453dc317..1c09c8b3 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,18 @@ 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", From eb7f85cabfc0b1246e442e488d7f4221bb7ccef1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Feb 2022 17:24:00 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 1c09c8b3..3a6c581e 100644 --- a/setup.py +++ b/setup.py @@ -7,9 +7,10 @@ dconv_source_files = glob("./deps/double-conversion/double-conversion/*.cc") dconv_source_files.append("./lib/dconv_wrapper.cc") -if platform.system() == "Linux" and environ.get( - "UJSON_BUILD_NO_STRIP", "0" -) not in ("1", "True"): +if platform.system() == "Linux" and environ.get("UJSON_BUILD_NO_STRIP", "0") not in ( + "1", + "True", +): strip_flags = ["-Wl,--strip-all"] else: strip_flags = []