mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
scripted-diff: Use new python 3.7 keywords
-BEGIN VERIFY SCRIPT- sed -i 's/universal_newlines/text/g' $(git grep -l universal_newlines) -END VERIFY SCRIPT-
This commit is contained in:
parent
fa2a23548a
commit
fa8fe5b696
23 changed files with 47 additions and 47 deletions
|
@ -146,7 +146,7 @@ def main():
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=None,
|
stderr=None,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
universal_newlines=True)
|
text=True)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
sys.exit(p.returncode)
|
sys.exit(p.returncode)
|
||||||
|
|
|
@ -23,7 +23,7 @@ help2man = os.getenv('HELP2MAN', 'help2man')
|
||||||
# If not otherwise specified, get top directory from git.
|
# If not otherwise specified, get top directory from git.
|
||||||
topdir = os.getenv('TOPDIR')
|
topdir = os.getenv('TOPDIR')
|
||||||
if not topdir:
|
if not topdir:
|
||||||
r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, universal_newlines=True)
|
r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, text=True)
|
||||||
topdir = r.stdout.rstrip()
|
topdir = r.stdout.rstrip()
|
||||||
|
|
||||||
# Get input and output directories.
|
# Get input and output directories.
|
||||||
|
@ -36,7 +36,7 @@ versions = []
|
||||||
for relpath in BINARIES:
|
for relpath in BINARIES:
|
||||||
abspath = os.path.join(builddir, relpath)
|
abspath = os.path.join(builddir, relpath)
|
||||||
try:
|
try:
|
||||||
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, universal_newlines=True)
|
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
||||||
except IOError:
|
except IOError:
|
||||||
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -39,7 +39,7 @@ def call_security_check(cc, source, executable, options):
|
||||||
env_flags += filter(None, os.environ.get(var, '').split(' '))
|
env_flags += filter(None, os.environ.get(var, '').split(' '))
|
||||||
|
|
||||||
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
|
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
|
||||||
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, universal_newlines=True)
|
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, text=True)
|
||||||
return (p.returncode, p.stdout.rstrip())
|
return (p.returncode, p.stdout.rstrip())
|
||||||
|
|
||||||
def get_arch(cc, source, executable):
|
def get_arch(cc, source, executable):
|
||||||
|
|
|
@ -23,13 +23,13 @@ def call_symbol_check(cc: List[str], source, executable, options):
|
||||||
env_flags += filter(None, os.environ.get(var, '').split(' '))
|
env_flags += filter(None, os.environ.get(var, '').split(' '))
|
||||||
|
|
||||||
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
|
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
|
||||||
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'symbol-check.py'), executable], stdout=subprocess.PIPE, universal_newlines=True)
|
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'symbol-check.py'), executable], stdout=subprocess.PIPE, text=True)
|
||||||
os.remove(source)
|
os.remove(source)
|
||||||
os.remove(executable)
|
os.remove(executable)
|
||||||
return (p.returncode, p.stdout.rstrip())
|
return (p.returncode, p.stdout.rstrip())
|
||||||
|
|
||||||
def get_machine(cc: List[str]):
|
def get_machine(cc: List[str]):
|
||||||
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, universal_newlines=True)
|
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, text=True)
|
||||||
return p.stdout.rstrip()
|
return p.stdout.rstrip()
|
||||||
|
|
||||||
class TestSymbolChecks(unittest.TestCase):
|
class TestSymbolChecks(unittest.TestCase):
|
||||||
|
|
|
@ -187,7 +187,7 @@ def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]:
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Inspecting with otool: {binaryPath}")
|
print(f"Inspecting with otool: {binaryPath}")
|
||||||
otoolbin=os.getenv("OTOOL", "otool")
|
otoolbin=os.getenv("OTOOL", "otool")
|
||||||
otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, text=True)
|
||||||
if otool.returncode != 0:
|
if otool.returncode != 0:
|
||||||
sys.stderr.write(otool.stderr)
|
sys.stderr.write(otool.stderr)
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
@ -577,17 +577,17 @@ if config.dmg is not None:
|
||||||
|
|
||||||
tempname: str = appname + ".temp.dmg"
|
tempname: str = appname + ".temp.dmg"
|
||||||
|
|
||||||
run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, universal_newlines=True)
|
run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, text=True)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Attaching temp image...")
|
print("Attaching temp image...")
|
||||||
output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, universal_newlines=True, stdout=PIPE).stdout
|
output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, text=True, stdout=PIPE).stdout
|
||||||
|
|
||||||
print("+ Finalizing .dmg disk image +")
|
print("+ Finalizing .dmg disk image +")
|
||||||
|
|
||||||
run(["hdiutil", "detach", f"/Volumes/{appname}"], universal_newlines=True)
|
run(["hdiutil", "detach", f"/Volumes/{appname}"], text=True)
|
||||||
|
|
||||||
run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, universal_newlines=True)
|
run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, text=True)
|
||||||
|
|
||||||
os.unlink(tempname)
|
os.unlink(tempname)
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,13 @@ class HTTPBasicsTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Generate RPCAUTH with specified password
|
# Generate RPCAUTH with specified password
|
||||||
self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="
|
self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="
|
||||||
p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, universal_newlines=True)
|
p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, text=True)
|
||||||
lines = p.stdout.read().splitlines()
|
lines = p.stdout.read().splitlines()
|
||||||
rpcauth2 = lines[1]
|
rpcauth2 = lines[1]
|
||||||
|
|
||||||
# Generate RPCAUTH without specifying password
|
# Generate RPCAUTH without specifying password
|
||||||
self.user = ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(10))
|
self.user = ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(10))
|
||||||
p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, universal_newlines=True)
|
p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, text=True)
|
||||||
lines = p.stdout.read().splitlines()
|
lines = p.stdout.read().splitlines()
|
||||||
rpcauth3 = lines[1]
|
rpcauth3 = lines[1]
|
||||||
self.password = lines[3]
|
self.password = lines[3]
|
||||||
|
|
|
@ -730,7 +730,7 @@ class TestNodeCLI():
|
||||||
p_args += [command]
|
p_args += [command]
|
||||||
p_args += pos_args + named_args
|
p_args += pos_args + named_args
|
||||||
self.log.debug("Running bitcoin-cli {}".format(p_args[2:]))
|
self.log.debug("Running bitcoin-cli {}".format(p_args[2:]))
|
||||||
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||||
cli_stdout, cli_stderr = process.communicate(input=self.input)
|
cli_stdout, cli_stderr = process.communicate(input=self.input)
|
||||||
returncode = process.poll()
|
returncode = process.poll()
|
||||||
if returncode:
|
if returncode:
|
||||||
|
|
|
@ -585,7 +585,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
|
||||||
combined_logs_args = [sys.executable, os.path.join(tests_dir, 'combine_logs.py'), testdir]
|
combined_logs_args = [sys.executable, os.path.join(tests_dir, 'combine_logs.py'), testdir]
|
||||||
if BOLD[0]:
|
if BOLD[0]:
|
||||||
combined_logs_args += ['--color']
|
combined_logs_args += ['--color']
|
||||||
combined_logs, _ = subprocess.Popen(combined_logs_args, universal_newlines=True, stdout=subprocess.PIPE).communicate()
|
combined_logs, _ = subprocess.Popen(combined_logs_args, text=True, stdout=subprocess.PIPE).communicate()
|
||||||
print("\n".join(deque(combined_logs.splitlines(), combined_logs_len)))
|
print("\n".join(deque(combined_logs.splitlines(), combined_logs_len)))
|
||||||
|
|
||||||
if failfast:
|
if failfast:
|
||||||
|
@ -670,7 +670,7 @@ class TestHandler:
|
||||||
self.jobs.append((test,
|
self.jobs.append((test,
|
||||||
time.time(),
|
time.time(),
|
||||||
subprocess.Popen([sys.executable, self.tests_dir + test_argv[0]] + test_argv[1:] + self.flags + portseed_arg + tmpdir_arg,
|
subprocess.Popen([sys.executable, self.tests_dir + test_argv[0]] + test_argv[1:] + self.flags + portseed_arg + tmpdir_arg,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
stdout=log_stdout,
|
stdout=log_stdout,
|
||||||
stderr=log_stderr),
|
stderr=log_stderr),
|
||||||
testdir,
|
testdir,
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ToolWalletTest(BitcoinTestFramework):
|
||||||
if not self.options.descriptors and 'create' in args:
|
if not self.options.descriptors and 'create' in args:
|
||||||
default_args.append('-legacy')
|
default_args.append('-legacy')
|
||||||
|
|
||||||
return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||||
|
|
||||||
def assert_raises_tool_error(self, error, *args):
|
def assert_raises_tool_error(self, error, *args):
|
||||||
p = self.bitcoin_wallet_process(*args)
|
p = self.bitcoin_wallet_process(*args)
|
||||||
|
|
|
@ -143,7 +143,7 @@ def main():
|
||||||
timeout=20,
|
timeout=20,
|
||||||
check=True,
|
check=True,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
).stderr
|
).stderr
|
||||||
if "libFuzzer" not in help_output:
|
if "libFuzzer" not in help_output:
|
||||||
logging.error("Must be built with libFuzzer")
|
logging.error("Must be built with libFuzzer")
|
||||||
|
@ -200,7 +200,7 @@ def generate_corpus(*, fuzz_pool, src_dir, build_dir, corpus_dir, targets):
|
||||||
env=get_fuzz_env(target=t, source_dir=src_dir),
|
env=get_fuzz_env(target=t, source_dir=src_dir),
|
||||||
check=True,
|
check=True,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
).stderr))
|
).stderr))
|
||||||
|
|
||||||
futures = []
|
futures = []
|
||||||
|
@ -241,7 +241,7 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir)
|
||||||
env=get_fuzz_env(target=t, source_dir=src_dir),
|
env=get_fuzz_env(target=t, source_dir=src_dir),
|
||||||
check=True,
|
check=True,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
).stderr
|
).stderr
|
||||||
logging.debug(output)
|
logging.debug(output)
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ def run_once(*, fuzz_pool, corpus, test_list, src_dir, build_dir, use_valgrind):
|
||||||
args,
|
args,
|
||||||
env=get_fuzz_env(target=t, source_dir=src_dir),
|
env=get_fuzz_env(target=t, source_dir=src_dir),
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
)
|
)
|
||||||
output += result.stderr
|
output += result.stderr
|
||||||
return output, result
|
return output, result
|
||||||
|
@ -299,7 +299,7 @@ def parse_test_list(*, fuzz_bin):
|
||||||
},
|
},
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
).stdout.splitlines()
|
).stdout.splitlines()
|
||||||
return test_list_all
|
return test_list_all
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import subprocess
|
||||||
|
|
||||||
def git_grep(params: [], error_msg: ""):
|
def git_grep(params: [], error_msg: ""):
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(["git", "grep", *params], universal_newlines=True, encoding="utf8")
|
output = subprocess.check_output(["git", "grep", *params], text=True, encoding="utf8")
|
||||||
print(error_msg)
|
print(error_msg)
|
||||||
print(output)
|
print(output)
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -38,14 +38,14 @@ def main():
|
||||||
os.chdir(CODE_DIR)
|
os.chdir(CODE_DIR)
|
||||||
files = subprocess.check_output(
|
files = subprocess.check_output(
|
||||||
['git', 'ls-files', '--', '*.h', '*.cpp'],
|
['git', 'ls-files', '--', '*.h', '*.cpp'],
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
).splitlines()
|
).splitlines()
|
||||||
|
|
||||||
command = [sys.executable, "../contrib/devtools/circular-dependencies.py", *files]
|
command = [sys.executable, "../contrib/devtools/circular-dependencies.py", *files]
|
||||||
dependencies_output = subprocess.run(
|
dependencies_output = subprocess.run(
|
||||||
command,
|
command,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
for dependency_str in dependencies_output.stdout.rstrip().split("\n"):
|
for dependency_str in dependencies_output.stdout.rstrip().split("\n"):
|
||||||
|
|
|
@ -42,17 +42,17 @@ def main():
|
||||||
commit_range = "HEAD~" + args.prev_commits + "...HEAD"
|
commit_range = "HEAD~" + args.prev_commits + "...HEAD"
|
||||||
else:
|
else:
|
||||||
# This assumes that the target branch of the pull request will be master.
|
# This assumes that the target branch of the pull request will be master.
|
||||||
merge_base = check_output(["git", "merge-base", "HEAD", "master"], universal_newlines=True, encoding="utf8").rstrip("\n")
|
merge_base = check_output(["git", "merge-base", "HEAD", "master"], text=True, encoding="utf8").rstrip("\n")
|
||||||
commit_range = merge_base + "..HEAD"
|
commit_range = merge_base + "..HEAD"
|
||||||
else:
|
else:
|
||||||
commit_range = os.getenv("COMMIT_RANGE")
|
commit_range = os.getenv("COMMIT_RANGE")
|
||||||
if commit_range == "SKIP_EMPTY_NOT_A_PR":
|
if commit_range == "SKIP_EMPTY_NOT_A_PR":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
commit_hashes = check_output(["git", "log", commit_range, "--format=%H"], universal_newlines=True, encoding="utf8").splitlines()
|
commit_hashes = check_output(["git", "log", commit_range, "--format=%H"], text=True, encoding="utf8").splitlines()
|
||||||
|
|
||||||
for hash in commit_hashes:
|
for hash in commit_hashes:
|
||||||
commit_info = check_output(["git", "log", "--format=%B", "-n", "1", hash], universal_newlines=True, encoding="utf8").splitlines()
|
commit_info = check_output(["git", "log", "--format=%B", "-n", "1", hash], text=True, encoding="utf8").splitlines()
|
||||||
if len(commit_info) >= 2:
|
if len(commit_info) >= 2:
|
||||||
if commit_info[1]:
|
if commit_info[1]:
|
||||||
print(f"The subject line of commit hash {hash} is followed by a non-empty line. Subject lines should always be followed by a blank line.")
|
print(f"The subject line of commit hash {hash} is followed by a non-empty line. Subject lines should always be followed by a blank line.")
|
||||||
|
|
|
@ -35,13 +35,13 @@ EXPECTED_BOOST_INCLUDES = ["boost/date_time/posix_time/posix_time.hpp",
|
||||||
|
|
||||||
|
|
||||||
def get_toplevel():
|
def get_toplevel():
|
||||||
return check_output(["git", "rev-parse", "--show-toplevel"], universal_newlines=True, encoding="utf8").rstrip("\n")
|
return check_output(["git", "rev-parse", "--show-toplevel"], text=True, encoding="utf8").rstrip("\n")
|
||||||
|
|
||||||
|
|
||||||
def list_files_by_suffix(suffixes):
|
def list_files_by_suffix(suffixes):
|
||||||
exclude_args = [":(exclude)" + dir for dir in EXCLUDED_DIRS]
|
exclude_args = [":(exclude)" + dir for dir in EXCLUDED_DIRS]
|
||||||
|
|
||||||
files_list = check_output(["git", "ls-files", "src"] + exclude_args, universal_newlines=True, encoding="utf8").splitlines()
|
files_list = check_output(["git", "ls-files", "src"] + exclude_args, text=True, encoding="utf8").splitlines()
|
||||||
|
|
||||||
return [file for file in files_list if file.endswith(suffixes)]
|
return [file for file in files_list if file.endswith(suffixes)]
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ def find_included_cpps():
|
||||||
included_cpps = list()
|
included_cpps = list()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
included_cpps = check_output(["git", "grep", "-E", r"^#include [<\"][^>\"]+\.cpp[>\"]", "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8").splitlines()
|
included_cpps = check_output(["git", "grep", "-E", r"^#include [<\"][^>\"]+\.cpp[>\"]", "--", "*.cpp", "*.h"], text=True, encoding="utf8").splitlines()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
@ -77,7 +77,7 @@ def find_extra_boosts():
|
||||||
exclusion_set = set()
|
exclusion_set = set()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
included_boosts = check_output(["git", "grep", "-E", r"^#include <boost/", "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8").splitlines()
|
included_boosts = check_output(["git", "grep", "-E", r"^#include <boost/", "--", "*.cpp", "*.h"], text=True, encoding="utf8").splitlines()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
@ -100,7 +100,7 @@ def find_quote_syntax_inclusions():
|
||||||
quote_syntax_inclusions = list()
|
quote_syntax_inclusions = list()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
quote_syntax_inclusions = check_output(["git", "grep", r"^#include \"", "--", "*.cpp", "*.h"] + exclude_args, universal_newlines=True, encoding="utf8").splitlines()
|
quote_syntax_inclusions = check_output(["git", "grep", r"^#include \"", "--", "*.cpp", "*.h"] + exclude_args, text=True, encoding="utf8").splitlines()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
@ -143,13 +143,13 @@ def main():
|
||||||
if extra_boosts:
|
if extra_boosts:
|
||||||
for boost in extra_boosts:
|
for boost in extra_boosts:
|
||||||
print(f"A new Boost dependency in the form of \"{boost}\" appears to have been introduced:")
|
print(f"A new Boost dependency in the form of \"{boost}\" appears to have been introduced:")
|
||||||
print(check_output(["git", "grep", boost, "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8"))
|
print(check_output(["git", "grep", boost, "--", "*.cpp", "*.h"], text=True, encoding="utf8"))
|
||||||
exit_code = 1
|
exit_code = 1
|
||||||
|
|
||||||
# Check if Boost dependencies are no longer used
|
# Check if Boost dependencies are no longer used
|
||||||
for expected_boost in EXPECTED_BOOST_INCLUDES:
|
for expected_boost in EXPECTED_BOOST_INCLUDES:
|
||||||
try:
|
try:
|
||||||
check_output(["git", "grep", "-q", r"^#include <%s>" % expected_boost, "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8")
|
check_output(["git", "grep", "-q", r"^#include <%s>" % expected_boost, "--", "*.cpp", "*.h"], text=True, encoding="utf8")
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
|
|
@ -223,7 +223,7 @@ def find_locale_dependent_function_uses():
|
||||||
git_grep_output = list()
|
git_grep_output = list()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
git_grep_output = check_output(git_grep_command, universal_newlines=True, encoding="utf8").splitlines()
|
git_grep_output = check_output(git_grep_command, text=True, encoding="utf8").splitlines()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
|
|
@ -16,7 +16,7 @@ from subprocess import check_output
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|LogPrintf?)\(", "--", "*.cpp"], universal_newlines=True, encoding="utf8").splitlines()
|
logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|LogPrintf?)\(", "--", "*.cpp"], text=True, encoding="utf8").splitlines()
|
||||||
|
|
||||||
unterminated_logs = [line for line in logs_list if not re.search(r'(\\n"|/\* Continued \*/)', line)]
|
unterminated_logs = [line for line in logs_list if not re.search(r'(\\n"|/\* Continued \*/)', line)]
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ def main():
|
||||||
"--",
|
"--",
|
||||||
"*.py",
|
"*.py",
|
||||||
]
|
]
|
||||||
output = subprocess.run(command, stdout=subprocess.PIPE, universal_newlines=True)
|
output = subprocess.run(command, stdout=subprocess.PIPE, text=True)
|
||||||
if len(output.stdout) > 0:
|
if len(output.stdout) > 0:
|
||||||
error_msg = (
|
error_msg = (
|
||||||
"A mutable list or dict seems to be used as default parameter value:\n\n"
|
"A mutable list or dict seems to be used as default parameter value:\n\n"
|
||||||
|
|
|
@ -23,7 +23,7 @@ def check_fileopens():
|
||||||
fileopens = list()
|
fileopens = list()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fileopens = check_output(["git", "grep", r" open(", "--", "*.py"] + get_exclude_args(), universal_newlines=True, encoding="utf8").splitlines()
|
fileopens = check_output(["git", "grep", r" open(", "--", "*.py"] + get_exclude_args(), text=True, encoding="utf8").splitlines()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
@ -37,12 +37,12 @@ def check_checked_outputs():
|
||||||
checked_outputs = list()
|
checked_outputs = list()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
checked_outputs = check_output(["git", "grep", "check_output(", "--", "*.py"] + get_exclude_args(), universal_newlines=True, encoding="utf8").splitlines()
|
checked_outputs = check_output(["git", "grep", "check_output(", "--", "*.py"] + get_exclude_args(), text=True, encoding="utf8").splitlines()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode > 1:
|
if e.returncode > 1:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
filtered_checked_outputs = [checked_output for checked_output in checked_outputs if re.search(r"universal_newlines=True", checked_output) and not re.search(r"encoding=.(ascii|utf8|utf-8).", checked_output)]
|
filtered_checked_outputs = [checked_output for checked_output in checked_outputs if re.search(r"text=True", checked_output) and not re.search(r"encoding=.(ascii|utf8|utf-8).", checked_output)]
|
||||||
|
|
||||||
return filtered_checked_outputs
|
return filtered_checked_outputs
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ def check_shellcheck_install():
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def get_files(command):
|
def get_files(command):
|
||||||
output = subprocess.run(command, stdout=subprocess.PIPE, universal_newlines=True)
|
output = subprocess.run(command, stdout=subprocess.PIPE, text=True)
|
||||||
files = output.stdout.split('\n')
|
files = output.stdout.split('\n')
|
||||||
|
|
||||||
# remove whitespace element
|
# remove whitespace element
|
||||||
|
|
|
@ -13,7 +13,7 @@ import sys
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
submodules_list = subprocess.check_output(['git', 'submodule', 'status', '--recursive'],
|
submodules_list = subprocess.check_output(['git', 'submodule', 'status', '--recursive'],
|
||||||
universal_newlines = True, encoding = 'utf8').rstrip('\n')
|
text = True, encoding = 'utf8').rstrip('\n')
|
||||||
if submodules_list:
|
if submodules_list:
|
||||||
print("These submodules were found, delete them:\n", submodules_list)
|
print("These submodules were found, delete them:\n", submodules_list)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -23,7 +23,7 @@ def grep_boost_fixture_test_suite():
|
||||||
"src/test/**.cpp",
|
"src/test/**.cpp",
|
||||||
"src/wallet/test/**.cpp",
|
"src/wallet/test/**.cpp",
|
||||||
]
|
]
|
||||||
return subprocess.check_output(command, universal_newlines=True, encoding="utf8")
|
return subprocess.check_output(command, text=True, encoding="utf8")
|
||||||
|
|
||||||
|
|
||||||
def check_matching_test_names(test_suite_list):
|
def check_matching_test_names(test_suite_list):
|
||||||
|
|
|
@ -80,7 +80,7 @@ def get_diff(commit_range, check_only_code):
|
||||||
else:
|
else:
|
||||||
what_files = ["."]
|
what_files = ["."]
|
||||||
|
|
||||||
diff = check_output(["git", "diff", "-U0", commit_range, "--"] + what_files + exclude_args, universal_newlines=True, encoding="utf8")
|
diff = check_output(["git", "diff", "-U0", commit_range, "--"] + what_files + exclude_args, text=True, encoding="utf8")
|
||||||
|
|
||||||
return diff
|
return diff
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ def main():
|
||||||
commit_range = "HEAD~" + args.prev_commits + "...HEAD"
|
commit_range = "HEAD~" + args.prev_commits + "...HEAD"
|
||||||
else:
|
else:
|
||||||
# This assumes that the target branch of the pull request will be master.
|
# This assumes that the target branch of the pull request will be master.
|
||||||
merge_base = check_output(["git", "merge-base", "HEAD", "master"], universal_newlines=True, encoding="utf8").rstrip("\n")
|
merge_base = check_output(["git", "merge-base", "HEAD", "master"], text=True, encoding="utf8").rstrip("\n")
|
||||||
commit_range = merge_base + "..HEAD"
|
commit_range = merge_base + "..HEAD"
|
||||||
else:
|
else:
|
||||||
commit_range = os.getenv("COMMIT_RANGE")
|
commit_range = os.getenv("COMMIT_RANGE")
|
||||||
|
|
|
@ -107,7 +107,7 @@ def bctest(testDir, testObj, buildenv):
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
# Run the test
|
# Run the test
|
||||||
proc = subprocess.Popen(execrun, stdin=stdinCfg, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
proc = subprocess.Popen(execrun, stdin=stdinCfg, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||||
try:
|
try:
|
||||||
outs = proc.communicate(input=inputData)
|
outs = proc.communicate(input=inputData)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
Loading…
Add table
Reference in a new issue