From 86ebdefa434a6aeb32c550f38b0a7218f805d909 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Wed, 11 Oct 2017 16:36:20 +0300 Subject: [PATCH] Made build with scons 3.0.0 work fixing issue #2093 --- SConstruct | 8 ++++---- po/SConscript | 8 ++++---- scons/ieee_754.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SConstruct b/SConstruct index edc833d87d45d..7d53a10477590 100755 --- a/SConstruct +++ b/SConstruct @@ -17,7 +17,7 @@ from os import access, F_OK # Warn user of current set of build options. AddOption('--option-cache', dest='option_cache', nargs=1, type = 'string', action = 'store', metavar = 'FILE', help='file with cached construction variables', default = '.scons-option-cache') if os.path.exists(GetOption("option_cache")): - optfile = file(GetOption("option_cache")) + optfile = open(GetOption("option_cache")) print("Saved options: {}".format(optfile.read().replace("\n", ", ")[:-2])) optfile.close() @@ -26,7 +26,7 @@ if os.path.exists(GetOption("option_cache")): # config_h_re = re.compile(r"^.*#define\s*(\S*)\s*\"(\S*)\".*$", re.MULTILINE) -build_config = dict( config_h_re.findall(File("src/wesconfig.h").get_contents()) ) +build_config = dict( config_h_re.findall(File("src/wesconfig.h").get_contents().decode("utf-8")) ) try: version = build_config["VERSION"] print("Building Wesnoth version %s" % version) @@ -231,7 +231,7 @@ specifying --option-cache=FILE command line argument. Current option values can If you set CXXFLAGS and/or LDFLAGS in the environment, the values will be appended to the appropriate variables within scons. -""" + opts.GenerateHelpText(env, sort=cmp)) +""" + opts.GenerateHelpText(env)) if GetOption("help"): Return() @@ -619,7 +619,7 @@ def CopyFilter(fn): env["copy_filter"] = CopyFilter -linguas = Split(File("po/LINGUAS").get_contents()) +linguas = Split(File("po/LINGUAS").get_contents().decode("utf-8")) def InstallManpages(env, component): env.InstallData("mandir", component, os.path.join("doc", "man", component + ".6"), "man6") diff --git a/po/SConscript b/po/SConscript index 8e179801a5b6f..9481e7f4299ed 100644 --- a/po/SConscript +++ b/po/SConscript @@ -4,7 +4,7 @@ from subprocess import Popen, PIPE import os, shutil import re from fnmatch import fnmatch -from os.path import join, walk +from os.path import join Import("env") def remove_pot_cdate(path): @@ -33,13 +33,13 @@ if "pot-update" in COMMAND_LINE_TARGETS: def fill_source_list(arg, dir, files): for file in files: if fnmatch(file, "*.[hc]pp"): - match = re.search('^#define\\s+GETTEXT_DOMAIN\\s+"wesnoth(-.*)"', Dir(dir).File(file).get_contents(), re.MULTILINE) + match = re.search('^#define\\s+GETTEXT_DOMAIN\\s+"wesnoth(-.*)"', Dir(dir).File(file).get_contents().decode("utf-8"), re.MULTILINE) if match: source_domain = match.group(1) else: source_domain = "" domain_sources[source_domain].append(Dir(dir).File(file).path) - walk("../src", fill_source_list, None) + os.walk("../src", fill_source_list, None) for domain in textdomains: pot = File(join(domain, domain + ".pot")) @@ -68,7 +68,7 @@ if "pot-update" in COMMAND_LINE_TARGETS: cfgs = [] FINDCFG = join(domain, "FINDCFG") if os.path.exists(FINDCFG): - cfgs = Split(Popen(["sh", join("po", FINDCFG)], stdout = PIPE, cwd = "..").communicate()[0]) + cfgs = Split(Popen(["sh", join("po", FINDCFG)], stdout = PIPE, cwd = "..").communicate()[0].decode("utf-8")) cfgs = [File(x, Dir("..")) for x in cfgs] if cfgs: wml_pot = env.Command( diff --git a/scons/ieee_754.py b/scons/ieee_754.py index 1fb5ca9bebc78..d3457532b6ffe 100644 --- a/scons/ieee_754.py +++ b/scons/ieee_754.py @@ -3,7 +3,7 @@ def CheckIEEE754(context): context.Message("Checking if floating point numbers are in the IEEE 754 format... ") - test_file = File(os.path.join("src", "compile_time_tests", "ieee_754.cpp")).get_contents() + test_file = File(os.path.join("src", "compile_time_tests", "ieee_754.cpp")).get_contents().decode("utf-8") ret, _ = context.TryRun(test_file, ".cpp") context.Result(ret) return ret