summaryrefslogtreecommitdiffstats
path: root/printing/cups_config_helper.py
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-04 18:09:39 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-04 18:09:39 +0000
commitfc2020f9e8a931a8bb26c4519a8ff5e3d559c39d (patch)
tree3e7ed7df5f569ed60665c4545d2529879283253c /printing/cups_config_helper.py
parentc7691efd06ce8cb77827121cfcc81ed1b61f1f47 (diff)
downloadchromium_src-fc2020f9e8a931a8bb26c4519a8ff5e3d559c39d.zip
chromium_src-fc2020f9e8a931a8bb26c4519a8ff5e3d559c39d.tar.gz
chromium_src-fc2020f9e8a931a8bb26c4519a8ff5e3d559c39d.tar.bz2
Add src/printing to the GN build.
BUG= R=thestig@chromium.org Review URL: https://codereview.chromium.org/311603003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/cups_config_helper.py')
-rwxr-xr-xprinting/cups_config_helper.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/printing/cups_config_helper.py b/printing/cups_config_helper.py
index 976054f..f3c22fa 100755
--- a/printing/cups_config_helper.py
+++ b/printing/cups_config_helper.py
@@ -11,7 +11,8 @@ to keep these separate: cflags are only needed when compiling files
that use cups directly, while libs are only needed on the final link
line.
-TODO(evan): remove me once
+This can be dramatically simplified or maybe removed (depending on GN
+requirements) when this is fixed:
https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/163704
is fixed.
"""
@@ -20,7 +21,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 +62,33 @@ 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 '['
+ for lib in flags:
+ if lib[:2] == "-l":
+ print '"%s", ' % lib[2:]
+ print ']'
+ else:
+ print ' '.join(flags)
+
return 0