Chromium Code Reviews| Index: printing/cups_config_helper.py |
| diff --git a/printing/cups_config_helper.py b/printing/cups_config_helper.py |
| index 976054f84dbe8b1bd2cd1522647fd50cab1097c7..59e477b77ed5f8d2740f5596cffe9313633678b0 100755 |
| --- a/printing/cups_config_helper.py |
| +++ b/printing/cups_config_helper.py |
| @@ -20,7 +20,8 @@ import subprocess |
| import sys |
| def usage(): |
| - print 'usage: %s {--cflags|--ldflags|--libs}' % sys.argv[0] |
| + print 'usage: %s {--api-version|--cflags|--ldflags|--libs|--libs-for-gn}' % \ |
| + sys.argv[0] |
| def run_cups_config(mode): |
| @@ -60,11 +61,32 @@ def main(): |
| return 1 |
| mode = sys.argv[1] |
| - if mode not in ('--cflags', '--libs', '--ldflags'): |
| + if mode == '--api-version': |
| + subprocess.call(['cups-config', '--api-version']) |
| + return 0 |
| + |
| + # All other modes get the flags. |
| + if mode not in ('--cflags', '--libs', '--libs-for-gn', '--ldflags'): |
| usage() |
| return 1 |
| + |
| + if mode == '--libs-for-gn': |
| + gn_libs_output = True |
| + mode = '--libs' |
| + else: |
| + gn_libs_output = False |
| + |
| flags = run_cups_config(mode) |
| - print ' '.join(flags) |
| + |
| + if gn_libs_output: |
| + # Strip "-l" from beginning of libs, quote, and surround in [ ]. |
| + print '[' |
|
Lei Zhang
2014/06/02 23:33:27
We should sanity check and make sure |lib| starts
|
| + for lib in flags: |
| + print '"%s", ' % lib[2:] |
| + print ']' |
| + else: |
| + print ' '.join(flags) |
| + |
| return 0 |