Blob Blame Raw
From b9a703e3d37e325defe5baec111e1fbf5d42bede Mon Sep 17 00:00:00 2001
From: Bohuslav Kabrda <bkabrda@redhat.com>
Date: Wed, 10 Apr 2013 14:30:09 +0200
Subject: [PATCH 4/9] 00178: Don't duplicate various FLAGS in sysconfig values

http://bugs.python.org/issue17679

Does not affect python2 AFAICS (different sysconfig values initialization)
---
 Lib/distutils/sysconfig.py | 5 ++++-
 Lib/sysconfig.py           | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 9a4892a737..ad4cef088b 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -373,7 +373,10 @@ def parse_makefile(fn, g=None):
                     done[n] = item = ""
                 if found:
                     after = value[m.end():]
-                    value = value[:m.start()] + item + after
+                    value = value[:m.start()]
+                    if item.strip() not in value:
+                        value += item
+                    value += after
                     if "$" in after:
                         notdone[name] = value
                     else:
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index cf64d79c4d..fd972d658c 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -295,7 +295,10 @@ def _parse_makefile(filename, vars=None):
 
                 if found:
                     after = value[m.end():]
-                    value = value[:m.start()] + item + after
+                    value = value[:m.start()]
+                    if item.strip() not in value:
+                        value += item
+                    value += after
                     if "$" in after:
                         notdone[name] = value
                     else:
-- 
2.21.0