@@ -21,18 +21,29 @@ def is_debug():
2121
2222
2323if is_debug ():
24- macroses .append (("PYXMLSEC_ENABLE_DEBUG" , 1 ))
24+ macroses .append (("PYXMLSEC_ENABLE_DEBUG" , "1" ))
2525 cflags .extend (["-Wall" , "-O0" ])
2626else :
2727 cflags .extend (["-Os" ])
2828
2929
30- def add_to_list (target , up ):
30+ # values which requires escaping
31+ require_escape = {"XMLSEC_CRYPTO" }
32+
33+
34+ def add_to_list (target , up , need_to_escape = None ):
3135 if up is None :
3236 return target
3337
3438 value = set (target )
35- value .update (up )
39+ if need_to_escape :
40+ for x in up :
41+ if x [0 ] in need_to_escape :
42+ value .add ((x [0 ], '"{0}"' .format (x [1 ])))
43+ else :
44+ value .add (x )
45+ else :
46+ value .update (up )
3647 target [:] = list (value )
3748
3849
@@ -61,10 +72,12 @@ def patch_xmlsec(self):
6172
6273 ext = self .ext_map [__name__ ]
6374 config = pkgconfig .parse ("xmlsec1" )
75+ # need to escape XMLSEC_CRYPTO
6476 # added build flags from pkg-config
65- for item in ('define_macros' , ' libraries' , 'library_dirs' , 'include_dirs' ):
77+ for item in ('libraries' , 'library_dirs' , 'include_dirs' ):
6678 add_to_list (getattr (ext , item ), config .get (item ))
6779
80+ add_to_list (ext .define_macros , config .get ('define_macros' ), {"XMLSEC_CRYPTO" })
6881 add_to_list (ext .include_dirs , lxml .get_include ())
6982
7083
0 commit comments