mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
Merge #14884: Travis: enforce Python 3.4 support through linter
31926ee8cf[test] functional framework: add CScript hex() for Python 3.4 (Sjors Provoost)74ce326831[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
This commit is contained in:
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.4.9
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
cache: false
|
cache: false
|
||||||
language: python
|
language: python
|
||||||
python: '3.6'
|
python: '3.4' # Oldest supported version according to doc/dependencies.md
|
||||||
install:
|
install:
|
||||||
- set -o errexit; source .travis/lint_04_install.sh
|
- set -o errexit; source .travis/lint_04_install.sh
|
||||||
before_script:
|
before_script:
|
||||||
|
|||||||
@@ -450,6 +450,10 @@ class CScript(bytes):
|
|||||||
# join makes no sense for a CScript()
|
# join makes no sense for a CScript()
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
# Python 3.4 compatibility
|
||||||
|
def hex(self):
|
||||||
|
return hexlify(self).decode('ascii')
|
||||||
|
|
||||||
def __new__(cls, value=b''):
|
def __new__(cls, value=b''):
|
||||||
if isinstance(value, bytes) or isinstance(value, bytearray):
|
if isinstance(value, bytes) or isinstance(value, bytearray):
|
||||||
return super(CScript, cls).__new__(cls, value)
|
return super(CScript, cls).__new__(cls, value)
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ SET_DOC_OPTIONAL = set(['-h', '-help', '-dbcrashratio', '-forcecompactdb'])
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if sys.version_info >= (3, 6):
|
||||||
used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True, encoding='utf8')
|
used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True, encoding='utf8')
|
||||||
docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True, encoding='utf8')
|
docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True, encoding='utf8')
|
||||||
|
else:
|
||||||
|
used = check_output(CMD_GREP_ARGS, shell=True, universal_newlines=True) # encoding='utf8'
|
||||||
|
docd = check_output(CMD_GREP_DOCS, shell=True, universal_newlines=True) # encoding='utf8'
|
||||||
|
|
||||||
args_used = set(re.findall(re.compile(REGEX_ARG), used))
|
args_used = set(re.findall(re.compile(REGEX_ARG), used))
|
||||||
args_docd = set(re.findall(re.compile(REGEX_DOC), docd)).union(SET_DOC_OPTIONAL)
|
args_docd = set(re.findall(re.compile(REGEX_DOC), docd)).union(SET_DOC_OPTIONAL)
|
||||||
|
|||||||
Reference in New Issue
Block a user