Skip to content

Commit 84dc252

Browse files
committed
Merge #14884: Travis: enforce Python 3.4 support through linter
31926ee [test] functional framework: add CScript hex() for Python 3.4 (Sjors Provoost) 74ce326 [test] Travis: enforce Python 3.4 support in functional tests (Sjors Provoost) Pull request description: The minimum supported version of Python is 3.4 according to [dependencies.md](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md). This PR makes the Travis linter use this version in order to catch accidental use of modern syntax. Tree-SHA512: 71b2c102be72b135a8ba049378d66875760f20a04a657102a399240c5c2b2ddbdfa7d5ab4c0c0242ecc3259e0ee8eb2273f331bc5eb824f4ae4c3cc58aea37ac
2 parents f17aca6 + 31926ee commit 84dc252

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.4.9

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
env:
4444
cache: false
4545
language: python
46-
python: '3.6'
46+
python: '3.4' # Oldest supported version according to doc/dependencies.md
4747
install:
4848
- set -o errexit; source .travis/lint_04_install.sh
4949
before_script:

test/functional/test_framework/script.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ def join(self, iterable):
450450
# join makes no sense for a CScript()
451451
raise NotImplementedError
452452

453+
# Python 3.4 compatibility
454+
def hex(self):
455+
return hexlify(self).decode('ascii')
456+
453457
def __new__(cls, value=b''):
454458
if isinstance(value, bytes) or isinstance(value, bytearray):
455459
return super(CScript, cls).__new__(cls, value)

test/lint/check-doc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@
2626

2727

2828
def main():
29-
used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True, encoding='utf8')
30-
docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True, encoding='utf8')
29+
if sys.version_info >= (3, 6):
30+
used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True, encoding='utf8')
31+
docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True, encoding='utf8')
32+
else:
33+
used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True) # encoding='utf8'
34+
docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True) # encoding='utf8'
3135

3236
args_used = set(re.findall(re.compile(REGEX_ARG), used))
3337
args_docd = set(re.findall(re.compile(REGEX_DOC), docd)).union(SET_DOC_OPTIONAL)

0 commit comments

Comments
 (0)