chiark / gitweb /
mdwsetup.py (pkg_config): Rearrange and reformat.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 1 Oct 2019 21:56:27 +0000 (22:56 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2020 11:30:13 +0000 (12:30 +0100)
mdwsetup.py

index a1f56b628f200ae326e7594a39ccf3cc779afa98..45772fb6f3a70a7ecff1040501747973f650a62a 100644 (file)
@@ -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.