Skip to content

Commit fa8fe5b

Browse files
author
MarcoFalke
committed
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-
1 parent fa2a235 commit fa8fe5b

23 files changed

+47
-47
lines changed

contrib/devtools/clang-format-diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def main():
146146
stdout=subprocess.PIPE,
147147
stderr=None,
148148
stdin=subprocess.PIPE,
149-
universal_newlines=True)
149+
text=True)
150150
stdout, stderr = p.communicate()
151151
if p.returncode != 0:
152152
sys.exit(p.returncode)

contrib/devtools/gen-manpages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# If not otherwise specified, get top directory from git.
2424
topdir = os.getenv('TOPDIR')
2525
if not topdir:
26-
r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, universal_newlines=True)
26+
r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, text=True)
2727
topdir = r.stdout.rstrip()
2828

2929
# Get input and output directories.
@@ -36,7 +36,7 @@
3636
for relpath in BINARIES:
3737
abspath = os.path.join(builddir, relpath)
3838
try:
39-
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, universal_newlines=True)
39+
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
4040
except IOError:
4141
print(f'{abspath} not found or not an executable', file=sys.stderr)
4242
sys.exit(1)

contrib/devtools/test-security-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def call_security_check(cc, source, executable, options):
3939
env_flags += filter(None, os.environ.get(var, '').split(' '))
4040

4141
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
42-
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, universal_newlines=True)
42+
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, text=True)
4343
return (p.returncode, p.stdout.rstrip())
4444

4545
def get_arch(cc, source, executable):

contrib/devtools/test-symbol-check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def call_symbol_check(cc: List[str], source, executable, options):
2323
env_flags += filter(None, os.environ.get(var, '').split(' '))
2424

2525
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
26-
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'symbol-check.py'), executable], stdout=subprocess.PIPE, universal_newlines=True)
26+
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'symbol-check.py'), executable], stdout=subprocess.PIPE, text=True)
2727
os.remove(source)
2828
os.remove(executable)
2929
return (p.returncode, p.stdout.rstrip())
3030

3131
def get_machine(cc: List[str]):
32-
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, universal_newlines=True)
32+
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, text=True)
3333
return p.stdout.rstrip()
3434

3535
class TestSymbolChecks(unittest.TestCase):

contrib/macdeploy/macdeployqtplus

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]:
187187
if verbose:
188188
print(f"Inspecting with otool: {binaryPath}")
189189
otoolbin=os.getenv("OTOOL", "otool")
190-
otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, universal_newlines=True)
190+
otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, text=True)
191191
if otool.returncode != 0:
192192
sys.stderr.write(otool.stderr)
193193
sys.stderr.flush()
@@ -577,17 +577,17 @@ if config.dmg is not None:
577577

578578
tempname: str = appname + ".temp.dmg"
579579

580-
run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, universal_newlines=True)
580+
run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, text=True)
581581

582582
if verbose:
583583
print("Attaching temp image...")
584-
output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, universal_newlines=True, stdout=PIPE).stdout
584+
output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, text=True, stdout=PIPE).stdout
585585

586586
print("+ Finalizing .dmg disk image +")
587587

588-
run(["hdiutil", "detach", f"/Volumes/{appname}"], universal_newlines=True)
588+
run(["hdiutil", "detach", f"/Volumes/{appname}"], text=True)
589589

590-
run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, universal_newlines=True)
590+
run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, text=True)
591591

592592
os.unlink(tempname)
593593

test/functional/rpc_users.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def setup_chain(self):
5353

5454
# Generate RPCAUTH with specified password
5555
self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="
56-
p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, universal_newlines=True)
56+
p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, text=True)
5757
lines = p.stdout.read().splitlines()
5858
rpcauth2 = lines[1]
5959

6060
# Generate RPCAUTH without specifying password
6161
self.user = ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(10))
62-
p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, universal_newlines=True)
62+
p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, text=True)
6363
lines = p.stdout.read().splitlines()
6464
rpcauth3 = lines[1]
6565
self.password = lines[3]

test/functional/test_framework/test_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def send_cli(self, command=None, *args, **kwargs):
730730
p_args += [command]
731731
p_args += pos_args + named_args
732732
self.log.debug("Running bitcoin-cli {}".format(p_args[2:]))
733-
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
733+
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
734734
cli_stdout, cli_stderr = process.communicate(input=self.input)
735735
returncode = process.poll()
736736
if returncode:

test/functional/test_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
585585
combined_logs_args = [sys.executable, os.path.join(tests_dir, 'combine_logs.py'), testdir]
586586
if BOLD[0]:
587587
combined_logs_args += ['--color']
588-
combined_logs, _ = subprocess.Popen(combined_logs_args, universal_newlines=True, stdout=subprocess.PIPE).communicate()
588+
combined_logs, _ = subprocess.Popen(combined_logs_args, text=True, stdout=subprocess.PIPE).communicate()
589589
print("\n".join(deque(combined_logs.splitlines(), combined_logs_len)))
590590

591591
if failfast:
@@ -670,7 +670,7 @@ def get_next(self):
670670
self.jobs.append((test,
671671
time.time(),
672672
subprocess.Popen([sys.executable, self.tests_dir + test_argv[0]] + test_argv[1:] + self.flags + portseed_arg + tmpdir_arg,
673-
universal_newlines=True,
673+
text=True,
674674
stdout=log_stdout,
675675
stderr=log_stderr),
676676
testdir,

test/functional/tool_wallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def bitcoin_wallet_process(self, *args):
3737
if not self.options.descriptors and 'create' in args:
3838
default_args.append('-legacy')
3939

40-
return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
40+
return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
4141

4242
def assert_raises_tool_error(self, error, *args):
4343
p = self.bitcoin_wallet_process(*args)

test/fuzz/test_runner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def main():
143143
timeout=20,
144144
check=True,
145145
stderr=subprocess.PIPE,
146-
universal_newlines=True,
146+
text=True,
147147
).stderr
148148
if "libFuzzer" not in help_output:
149149
logging.error("Must be built with libFuzzer")
@@ -200,7 +200,7 @@ def job(command, t):
200200
env=get_fuzz_env(target=t, source_dir=src_dir),
201201
check=True,
202202
stderr=subprocess.PIPE,
203-
universal_newlines=True,
203+
text=True,
204204
).stderr))
205205

206206
futures = []
@@ -241,7 +241,7 @@ def job(t, args):
241241
env=get_fuzz_env(target=t, source_dir=src_dir),
242242
check=True,
243243
stderr=subprocess.PIPE,
244-
universal_newlines=True,
244+
text=True,
245245
).stderr
246246
logging.debug(output)
247247

@@ -270,7 +270,7 @@ def job(t, args):
270270
args,
271271
env=get_fuzz_env(target=t, source_dir=src_dir),
272272
stderr=subprocess.PIPE,
273-
universal_newlines=True,
273+
text=True,
274274
)
275275
output += result.stderr
276276
return output, result
@@ -299,7 +299,7 @@ def parse_test_list(*, fuzz_bin):
299299
},
300300
stdout=subprocess.PIPE,
301301
stderr=subprocess.DEVNULL,
302-
universal_newlines=True,
302+
text=True,
303303
).stdout.splitlines()
304304
return test_list_all
305305

0 commit comments

Comments
 (0)