Scons/python3 - fix bytes to str conversions (#3798)

This commit is contained in:
Artem Pavlenko 2017-11-21 13:12:52 +01:00
parent 5732df452c
commit 047c3f4bba

View file

@ -521,7 +521,7 @@ opts.Update(env)
if not force_configure: if not force_configure:
if os.path.exists(SCONS_CONFIGURE_CACHE): if os.path.exists(SCONS_CONFIGURE_CACHE):
try: try:
pickled_environment = open(SCONS_CONFIGURE_CACHE, 'r') pickled_environment = open(SCONS_CONFIGURE_CACHE, 'rb')
pickled_values = pickle.load(pickled_environment) pickled_values = pickle.load(pickled_environment)
for key, value in pickled_values.items(): for key, value in pickled_values.items():
env[key] = value env[key] = value
@ -647,7 +647,7 @@ def get_pkg_lib(context, config, lib):
parsed = False parsed = False
if ret: if ret:
try: try:
value = call(cmd,silent=True) value = call(cmd, silent=True).decode("utf8")
if ' ' in value: if ' ' in value:
parts = value.split(' ') parts = value.split(' ')
if len(parts) > 1: if len(parts) > 1:
@ -660,7 +660,7 @@ def get_pkg_lib(context, config, lib):
libname = 'gdal' libname = 'gdal'
except Exception as e: except Exception as e:
ret = False ret = False
print (' unable to determine library name:# {}'.format(str(e))) print (' unable to determine library name:# {0!s}'.format(e))
return None return None
context.Result( libname ) context.Result( libname )
return libname return libname
@ -672,8 +672,8 @@ def parse_pg_config(context, config):
context.Message( 'Checking for %s... ' % tool) context.Message( 'Checking for %s... ' % tool)
ret = context.TryAction(env[config])[0] ret = context.TryAction(env[config])[0]
if ret: if ret:
lib_path = call('%s --libdir' % env[config]) lib_path = call('%s --libdir' % env[config]).decode("utf8")
inc_path = call('%s --includedir' % env[config]) inc_path = call('%s --includedir' % env[config]).decode("utf8")
env.AppendUnique(CPPPATH = fix_path(inc_path)) env.AppendUnique(CPPPATH = fix_path(inc_path))
env.AppendUnique(LIBPATH = fix_path(lib_path)) env.AppendUnique(LIBPATH = fix_path(lib_path))
lpq = env['PLUGINS']['postgis']['lib'] lpq = env['PLUGINS']['postgis']['lib']
@ -1266,7 +1266,7 @@ if not preconfigured:
color_print(4,"Configuring on %s in *%s*..." % (env['PLATFORM'],mode)) color_print(4,"Configuring on %s in *%s*..." % (env['PLATFORM'],mode))
cxx_version = call("%s --version" % env["CXX"] ,silent=True) cxx_version = call("%s --version" % env["CXX"] ,silent=True)
color_print(5, "CXX %s" % cxx_version) color_print(5, "CXX %s" % cxx_version.decode("utf8"))
env['MISSING_DEPS'] = [] env['MISSING_DEPS'] = []
env['SKIPPED_DEPS'] = [] env['SKIPPED_DEPS'] = []