From: Noel Power Date: Fri, 27 Jul 2018 15:54:16 +0000 (+0100) Subject: PY3: decode bytes in py3 where strings are needed X-Git-Tag: tdb-1.3.17~1492 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d94839f9f5b34f951d9b15532cecbdf3334a7b1;p=thirdparty%2Fsamba.git PY3: decode bytes in py3 where strings are needed Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py index 4981ff55637..d8f793638f5 100644 --- a/buildtools/wafsamba/samba_conftests.py +++ b/buildtools/wafsamba/samba_conftests.py @@ -508,7 +508,7 @@ def CHECK_STANDARD_LIBPATH(conf): # at least gcc and clang support this: try: cmd = conf.env.CC + ['-print-search-dirs'] - out = Utils.cmd_output(cmd).split('\n') + out = Utils.cmd_output(cmd).decode('utf8').split('\n') except ValueError: # option not supported by compiler - use a standard list of directories dirlist = [ '/usr/lib', '/usr/lib64' ] diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py index eca72d65790..3d4fe29027f 100644 --- a/buildtools/wafsamba/samba_perl.py +++ b/buildtools/wafsamba/samba_perl.py @@ -15,7 +15,10 @@ def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)): conf.check_perl_version(version) def read_perl_config_var(cmd): - return Utils.to_list(Utils.cmd_output([conf.env.get_flat('PERL'), '-MConfig', '-e', cmd])) + output = Utils.cmd_output([conf.env.get_flat('PERL'), '-MConfig', '-e', cmd]) + if not isinstance(output, str): + output = output.decode('utf8') + return Utils.to_list(output) def check_perl_config_var(var): conf.start_msg("Checking for perl $Config{%s}:" % var) diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 239f2445503..a5ad8103215 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -14,7 +14,7 @@ def git_version_summary(path, env=None): environ = dict(os.environ) environ["GIT_DIR"] = '%s/.git' % path environ["GIT_WORK_TREE"] = path - git = Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ) + git = Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ).decode('utf8') lines = git.splitlines() if not lines or len(lines) < 4: