From: Mark Wooding Date: Tue, 1 Oct 2019 21:56:27 +0000 (+0100) Subject: mdwsetup.py (pkg_config): Rearrange and reformat. X-Git-Tag: 1.4.0~14 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/cfd/commitdiff_plain/6f9cf5797c442bf17bb814743a57a695759842cc mdwsetup.py (pkg_config): Rearrange and reformat. --- 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.