From 6f9cf5797c442bf17bb814743a57a695759842cc Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 1 Oct 2019 22:56:27 +0100 Subject: [PATCH] mdwsetup.py (pkg_config): Rearrange and reformat. --- mdwsetup.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mdwsetup.py b/mdwsetup.py index a1f56b6..45772fb 100644 --- a/mdwsetup.py +++ b/mdwsetup.py @@ -97,22 +97,21 @@ def pkg_config(pkg, version): library-directory names are in LIBDIRS; and the library names themselves are in LIBS. """ - spec = '%s >= %s' % (pkg, version) + def weird(what, word): raise ValueError \ ("Unexpected `%s' item `%s' from package `%s'" % (what, word, pkg)) + + spec = '%s >= %s' % (pkg, version) + for word in progoutput(['pkg-config', '--cflags', spec]).split(): - if word.startswith('-I'): - INCLUDEDIRS.append(word[2:]) - else: - weird('--cflags', word) + if word.startswith('-I'): INCLUDEDIRS.append(word[2:]) + else: weird('--cflags', word) + for word in progoutput(['pkg-config', '--libs', spec]).split(): - if word.startswith('-L'): - LIBDIRS.append(word[2:]) - elif word.startswith('-l'): - LIBS.append(word[2:]) - else: - weird('--libs', word) + if word.startswith('-L'): LIBDIRS.append(word[2:]) + elif word.startswith('-l'): LIBS.append(word[2:]) + else: weird('--libs', word) ###-------------------------------------------------------------------------- ### Substituting variables in files. -- 2.11.0