Skip to content

Commit

Permalink
Add env var to control stripping debug info (#507)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
musicinmybrain committed Feb 15, 2022
1 parent c41db2a commit 097284e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 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",
Expand Down

0 comments on commit 097284e

Please sign in to comment.