diff options
author | sbc <sbc@chromium.org> | 2015-05-22 16:51:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-22 23:52:02 +0000 |
commit | 05ac52d4344270b0253d0b789e8621966d3af130 (patch) | |
tree | 3ad91c7760ae0c284203791378117747fccb4d4a /printing | |
parent | 234a58c8101de98d9746c1fda0bd1ce00ebbbe4d (diff) | |
download | chromium_src-05ac52d4344270b0253d0b789e8621966d3af130.zip chromium_src-05ac52d4344270b0253d0b789e8621966d3af130.tar.gz chromium_src-05ac52d4344270b0253d0b789e8621966d3af130.tar.bz2 |
Honor 'sysroot' setting when running cups-config
This mimic the existing behavior of build/linux/pkg-config-wrapper.
Review URL: https://codereview.chromium.org/1156773004
Cr-Commit-Position: refs/heads/master@{#331207}
Diffstat (limited to 'printing')
-rwxr-xr-x | printing/cups_config_helper.py | 20 | ||||
-rw-r--r-- | printing/printing.gyp | 4 |
2 files changed, 17 insertions, 7 deletions
diff --git a/printing/cups_config_helper.py b/printing/cups_config_helper.py index f3c22fa..138a688 100755 --- a/printing/cups_config_helper.py +++ b/printing/cups_config_helper.py @@ -17,6 +17,7 @@ requirements) when this is fixed: is fixed. """ +import os import subprocess import sys @@ -25,11 +26,11 @@ def usage(): sys.argv[0] -def run_cups_config(mode): +def run_cups_config(cups_config, mode): """Run cups-config with all --cflags etc modes, parse out the mode we want, and return those flags as a list.""" - cups = subprocess.Popen(['cups-config', '--cflags', '--ldflags', '--libs'], + cups = subprocess.Popen([cups_config, '--cflags', '--ldflags', '--libs'], stdout=subprocess.PIPE) flags = cups.communicate()[0].strip() @@ -57,13 +58,22 @@ def run_cups_config(mode): def main(): - if len(sys.argv) != 2: + if len(sys.argv) < 2: usage() return 1 mode = sys.argv[1] + if len(sys.argv) > 2: + sysroot = sys.argv[2] + cups_config = os.path.join(sysroot, 'usr', 'bin', 'cups-config') + if not os.path.exists(cups_config): + print 'cups-config not found: %s' % cups_config + return 1 + else: + cups_config = 'cups-config' + if mode == '--api-version': - subprocess.call(['cups-config', '--api-version']) + subprocess.call([cups_config, '--api-version']) return 0 # All other modes get the flags. @@ -77,7 +87,7 @@ def main(): else: gn_libs_output = False - flags = run_cups_config(mode) + flags = run_cups_config(cups_config, mode) if gn_libs_output: # Strip "-l" from beginning of libs, quote, and surround in [ ]. diff --git a/printing/printing.gyp b/printing/printing.gyp index 31c0f1d..eb4001d 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -273,13 +273,13 @@ }, { 'link_settings': { 'libraries': [ - '<!@(python cups_config_helper.py --libs)', + '<!@(python cups_config_helper.py --libs <(sysroot))', ], }, }], ['os_bsd==1', { 'cflags': [ - '<!@(python cups_config_helper.py --cflags)', + '<!@(python cups_config_helper.py --cflags <(sysroot))', ], }], ], |