MCPcopy Index your code
hub / github.com/nodejs/node / pkg_config

Function pkg_config

configure.py:1298–1323  ·  view source on GitHub ↗

Run pkg-config on the specified package Returns ("-l flags", "-I flags", "-L flags", "version") otherwise (None, None, None, None)

(pkg)

Source from the content-addressed store, hash-verified

1296 return s if isinstance(s, str) else s.decode("utf-8")
1297
1298def pkg_config(pkg):
1299 """Run pkg-config on the specified package
1300 Returns ("-l flags", "-I flags", "-L flags", "version")
1301 otherwise (None, None, None, None)"""
1302 pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
1303 args = [] # Print pkg-config warnings on first round.
1304 retval = []
1305 for flag in ['--libs-only-l', '--cflags-only-I',
1306 '--libs-only-L', '--modversion']:
1307 args += [flag]
1308 if isinstance(pkg, list):
1309 args += pkg
1310 else:
1311 args += [pkg]
1312 try:
1313 proc = subprocess.Popen(shlex.split(pkg_config) + args,
1314 stdout=subprocess.PIPE)
1315 with proc:
1316 val = to_utf8(proc.communicate()[0]).strip()
1317 except OSError as e:
1318 if e.errno != errno.ENOENT:
1319 raise e # Unexpected error.
1320 return (None, None, None, None) # No pkg-config/pkgconf installed.
1321 retval.append(val)
1322 args = ['--silence-errors']
1323 return tuple(retval)
1324
1325
1326def try_check_compiler(cc, lang):

Callers 3

configure_libraryFunction · 0.85
configure_v8Function · 0.85
configure_intlFunction · 0.85

Calls 4

to_utf8Function · 0.85
getMethod · 0.65
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…