Fix remaining python3 conventions

This commit is contained in:
mdr0id 2020-02-10 12:38:46 -08:00
parent fdac835b13
commit 826135d5ed
7 changed files with 9 additions and 11 deletions

View File

@ -167,7 +167,7 @@ class AcceptBlockTest(BitcoinTestFramework):
[ x.sync_with_ping() for x in [test_node, white_node] ] [ x.sync_with_ping() for x in [test_node, white_node] ]
assert_equal(self.nodes[0].getblockcount(), 2) assert_equal(self.nodes[0].getblockcount(), 2)
assert_equal(self.nodes[1].getblockcount(), 2) assert_equal(self.nodes[1].getblockcount(), 2)
print "First height 2 block accepted by both nodes" print("First height 2 block accepted by both nodes")
# 3. Send another block that builds on the original tip. # 3. Send another block that builds on the original tip.
blocks_h2f = [] # Blocks at height 2 that fork off the main chain blocks_h2f = [] # Blocks at height 2 that fork off the main chain

View File

@ -81,7 +81,7 @@ def ParseScriptFlags(flag_string):
if x in flag_map: if x in flag_map:
flags |= flag_map[x] flags |= flag_map[x]
else: else:
print "Error: unrecognized script flag: ", x print("Error: unrecognized script flag: ", x)
return flags return flags
''' '''

View File

@ -30,7 +30,7 @@ LD_LIBRARY_PATH=src/leveldb python qa/zcash/create_benchmark_archive.py
def check_deps(): def check_deps():
if subprocess.call(['which', 'find', 'xz', ZCASH_CLI], stdout=subprocess.PIPE): if subprocess.call(['which', 'find', 'xz', ZCASH_CLI], stdout=subprocess.PIPE):
print USAGE print(USAGE)
sys.exit() sys.exit()
def encode_varint(n): def encode_varint(n):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright (c) 2017 The Zcash developers # Copyright (c) 2017 The Zcash developers
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php . # file COPYING or https://www.opensource.org/licenses/mit-license.php .
@ -13,8 +13,6 @@
# - Archive the resulting /tmp/test###### directory # - Archive the resulting /tmp/test###### directory
# #
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import ( from test_framework.util import (
assert_equal, assert_equal,

View File

@ -27,10 +27,10 @@ def get_depends_sources_list():
for filename in get_depends_sources_list(): for filename in get_depends_sources_list():
resp = requests.head(MIRROR_URL_DIR + filename) resp = requests.head(MIRROR_URL_DIR + filename)
print "Checking [" + filename + "] ..." print("Checking [" + filename + "] ...")
if resp.status_code != 200: if resp.status_code != 200:
print "FAIL. File not found on server: " + filename print("FAIL. File not found on server: " + filename)
sys.exit(1) sys.exit(1)
expected_size = os.path.getsize(os.path.join(DEPENDS_SOURCES_DIR, filename)) expected_size = os.path.getsize(os.path.join(DEPENDS_SOURCES_DIR, filename))

View File

@ -656,7 +656,7 @@ if __name__ == '__main__':
actualargs = sys.argv actualargs = sys.argv
sys.argv = [sys.argv[0], '--verbose'] sys.argv = [sys.argv[0], '--verbose']
print '=== Self Test ===' print('=== Self Test ===')
try: try:
unittest.main() unittest.main()
except SystemExit as e: except SystemExit as e:
@ -664,5 +664,5 @@ if __name__ == '__main__':
raise raise
sys.argv = actualargs sys.argv = actualargs
print '=== Running ===' print('=== Running ===')
main() main()

View File

@ -76,7 +76,7 @@ def authors_in_release_notes(filename):
## Sums commits made by contributors in each Zcash release note in ./doc/release-notes and writes to authors.md ## Sums commits made by contributors in each Zcash release note in ./doc/release-notes and writes to authors.md
def document_authors(): def document_authors():
print "Writing contributors documented in release-notes directory to authors.md." print("Writing contributors documented in release-notes directory to authors.md.")
authors_file = os.path.join(doc_dir, 'authors.md') authors_file = os.path.join(doc_dir, 'authors.md')
with open(authors_file, 'w') as f: with open(authors_file, 'w') as f:
f.write('Zcash Contributors\n==================\n\n') f.write('Zcash Contributors\n==================\n\n')