0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

build: unbreak configure with python 2.6

Commit 2b1c01c2c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: https://github.com/nodejs/node/issues/6711
PR-URL: https://github.com/nodejs/node/pull/6874
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
Ben Noordhuis 2016-05-19 12:29:40 +02:00
parent b6a646dc8a
commit 62376d99bd

19
configure vendored
View File

@ -1,4 +1,6 @@
#!/usr/bin/env python
import errno
import optparse
import os
import pprint
@ -435,19 +437,16 @@ def b(value):
def pkg_config(pkg):
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
args = '--silence-errors'
retval = ()
for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']:
try:
val = subprocess.check_output([pkg_config, args, flag, pkg])
# check_output returns bytes
val = val.encode().strip().rstrip('\n')
except subprocess.CalledProcessError:
# most likely missing a .pc-file
val = None
except OSError:
# no pkg-config/pkgconf installed
return (None, None, None)
proc = subprocess.Popen(
shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
stdout=subprocess.PIPE)
val = proc.communicate()[0].strip()
except OSError, e:
if e.errno != errno.ENOENT: raise e # Unexpected error.
return (None, None, None) # No pkg-config/pkgconf installed.
retval += (val,)
return retval