File tree Expand file tree Collapse file tree 1 file changed +26
-22
lines changed Expand file tree Collapse file tree 1 file changed +26
-22
lines changed Original file line number Diff line number Diff line change @@ -250,28 +250,32 @@ def _cmd_exists(cmd):
250250
251251
252252def _pkg_config (name ):
253- try :
254- command = os .environ .get ("PKG_CONFIG" , "pkg-config" )
255- command_libs = [command , "--libs-only-L" , name ]
256- command_cflags = [command , "--cflags-only-I" , name ]
257- if not DEBUG :
258- command_libs .append ("--silence-errors" )
259- command_cflags .append ("--silence-errors" )
260- libs = (
261- subprocess .check_output (command_libs )
262- .decode ("utf8" )
263- .strip ()
264- .replace ("-L" , "" )
265- )
266- cflags = (
267- subprocess .check_output (command_cflags )
268- .decode ("utf8" )
269- .strip ()
270- .replace ("-I" , "" )
271- )
272- return libs , cflags
273- except Exception :
274- pass
253+ command = os .environ .get ("PKG_CONFIG" , "pkg-config" )
254+ for keep_system in (True , False ):
255+ try :
256+ command_libs = [command , "--libs-only-L" , name ]
257+ command_cflags = [command , "--cflags-only-I" , name ]
258+ if keep_system :
259+ command_libs .append ("--keep-system-libs" )
260+ command_cflags .append ("--keep-system-cflags" )
261+ if not DEBUG :
262+ command_libs .append ("--silence-errors" )
263+ command_cflags .append ("--silence-errors" )
264+ libs = (
265+ subprocess .check_output (command_libs )
266+ .decode ("utf8" )
267+ .strip ()
268+ .replace ("-L" , "" )
269+ )
270+ cflags = (
271+ subprocess .check_output (command_cflags )
272+ .decode ("utf8" )
273+ .strip ()
274+ .replace ("-I" , "" )
275+ )
276+ return libs , cflags
277+ except Exception :
278+ pass
275279
276280
277281class pil_build_ext (build_ext ):
You can’t perform that action at this time.
0 commit comments