From 869684e757ad8bf10c91e67ba20f59597357476f Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sun, 8 Oct 2023 11:22:55 +0200 Subject: [PATCH] Avoid redefinition of _XOPEN_SOURCE --- cwcwidth/wcwidth_compat.h | 6 ++++++ setup.py | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cwcwidth/wcwidth_compat.h b/cwcwidth/wcwidth_compat.h index 538fcd2..fec7b3a 100644 --- a/cwcwidth/wcwidth_compat.h +++ b/cwcwidth/wcwidth_compat.h @@ -23,6 +23,12 @@ #ifndef WCWIDTH_COMPAT_H #define WCWIDTH_COMPAT_H +#include + +#if !defined(_WIN32) && !defined(_XOPEN_SOURCE) +#define _XOPEN_SOURCE +#endif + #include #if defined(USE_MK_WCWIDTH) diff --git a/setup.py b/setup.py index a1ad1aa..f8a3666 100644 --- a/setup.py +++ b/setup.py @@ -5,15 +5,12 @@ extension_sources = ["cwcwidth/_impl.pyx"] +define_macros = [] if platform.system() == "Windows": extension_sources.append("cwcwidth/wcwidth.c") - define_macros = [ + define_macrosa.append( ("USE_MK_WCWIDTH", None), - ] -else: - define_macros = [ - ("_XOPEN_SOURCE", "600"), - ] + ) ext_modules = [ Extension(