build: Require python 3.5

This commit is contained in:
MarcoFalke 2019-02-20 18:13:43 -05:00
parent fa6bf21f5e
commit fab5a1e0f4
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
17 changed files with 18 additions and 122 deletions

View file

@ -1 +1 @@
3.4.9 3.5

View file

@ -46,7 +46,7 @@ jobs:
env: env:
cache: false cache: false
language: python language: python
python: '3.4' # Oldest supported version according to doc/dependencies.md python: '3.5' # 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:
@ -158,7 +158,7 @@ jobs:
name: 'macOS 10.10 [GOAL: deploy] [no functional tests]' name: 'macOS 10.10 [GOAL: deploy] [no functional tests]'
env: >- env: >-
HOST=x86_64-apple-darwin14 HOST=x86_64-apple-darwin14
PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git" PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python3-dev python3-setuptools-git"
OSX_SDK=10.11 OSX_SDK=10.11
RUN_UNIT_TESTS=false RUN_UNIT_TESTS=false
RUN_FUNCTIONAL_TESTS=false RUN_FUNCTIONAL_TESTS=false

View file

@ -85,8 +85,8 @@ AC_PATH_TOOL(RANLIB, ranlib)
AC_PATH_TOOL(STRIP, strip) AC_PATH_TOOL(STRIP, strip)
AC_PATH_TOOL(GCOV, gcov) AC_PATH_TOOL(GCOV, gcov)
AC_PATH_PROG(LCOV, lcov) AC_PATH_PROG(LCOV, lcov)
dnl Python 3.4 is specified in .python-version and should be used if available, see doc/dependencies.md dnl Python 3.5 is specified in .python-version and should be used if available, see doc/dependencies.md
AC_PATH_PROGS([PYTHON], [python3.4 python3.5 python3.6 python3.7 python3 python]) AC_PATH_PROGS([PYTHON], [python3.5 python3.6 python3.7 python3.8 python3 python])
AC_PATH_PROG(GENHTML, genhtml) AC_PATH_PROG(GENHTML, genhtml)
AC_PATH_PROG([GIT], [git]) AC_PATH_PROG([GIT], [git])
AC_PATH_PROG(CCACHE,ccache) AC_PATH_PROG(CCACHE,ccache)

View file

@ -167,7 +167,7 @@ still compatible with the minimum supported Linux distribution versions.
Example usage after a gitian build: Example usage after a gitian build:
find ../gitian-builder/build -type f -executable | xargs python contrib/devtools/symbol-check.py find ../gitian-builder/build -type f -executable | xargs python3 contrib/devtools/symbol-check.py
If only supported symbols are used the return value will be 0 and the output will be empty. If only supported symbols are used the return value will be 0 and the output will be empty.

View file

@ -9,7 +9,7 @@ still compatible with the minimum supported Linux distribution versions.
Example usage: Example usage:
find ../gitian-builder/build -type f -executable | xargs python contrib/devtools/symbol-check.py find ../gitian-builder/build -type f -executable | xargs python3 contrib/devtools/symbol-check.py
''' '''
import subprocess import subprocess
import re import re

View file

@ -30,7 +30,7 @@ packages:
- "faketime" - "faketime"
- "bsdmainutils" - "bsdmainutils"
- "ca-certificates" - "ca-certificates"
- "python" - "python3"
remotes: remotes:
- "url": "https://github.com/bitcoin/bitcoin.git" - "url": "https://github.com/bitcoin/bitcoin.git"
"dir": "bitcoin" "dir": "bitcoin"

View file

@ -23,9 +23,9 @@ packages:
- "libcap-dev" - "libcap-dev"
- "libz-dev" - "libz-dev"
- "libbz2-dev" - "libbz2-dev"
- "python" - "python3"
- "python-dev" - "python3-dev"
- "python-setuptools" - "python3-setuptools"
- "fonts-tuffy" - "fonts-tuffy"
remotes: remotes:
- "url": "https://github.com/bitcoin/bitcoin.git" - "url": "https://github.com/bitcoin/bitcoin.git"

View file

@ -20,7 +20,7 @@ packages:
- "nsis" - "nsis"
- "zip" - "zip"
- "ca-certificates" - "ca-certificates"
- "python" - "python3"
- "rename" - "rename"
remotes: remotes:
- "url": "https://github.com/bitcoin/bitcoin.git" - "url": "https://github.com/bitcoin/bitcoin.git"

View file

@ -1,6 +1,5 @@
# Linearize # Linearize
Construct a linear, no-fork, best version of the Bitcoin blockchain. The scripts Construct a linear, no-fork, best version of the Bitcoin blockchain.
run using Python 3 but are compatible with Python 2.
## Step 1: Download hash list ## Step 1: Download hash list

View file

@ -1,90 +0,0 @@
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
ZMQ example using python3's asyncio
Bitcoin should be started with the command line arguments:
bitcoind -testnet -daemon \
-zmqpubrawtx=tcp://127.0.0.1:28332 \
-zmqpubrawblock=tcp://127.0.0.1:28332 \
-zmqpubhashtx=tcp://127.0.0.1:28332 \
-zmqpubhashblock=tcp://127.0.0.1:28332
We use the asyncio library here. `self.handle()` installs itself as a
future at the end of the function. Since it never returns with the event
loop having an empty stack of futures, this creates an infinite loop. An
alternative is to wrap the contents of `handle` inside `while True`.
The `@asyncio.coroutine` decorator and the `yield from` syntax found here
was introduced in python 3.4 and has been deprecated in favor of the `async`
and `await` keywords respectively.
A blocking example using python 2.7 can be obtained from the git history:
https://github.com/bitcoin/bitcoin/blob/37a7fe9e440b83e2364d5498931253937abe9294/contrib/zmq/zmq_sub.py
"""
import binascii
import asyncio
import zmq
import zmq.asyncio
import signal
import struct
import sys
if (sys.version_info.major, sys.version_info.minor) < (3, 4):
print("This example only works with Python 3.4 and greater")
sys.exit(1)
port = 28332
class ZMQHandler():
def __init__(self):
self.loop = asyncio.get_event_loop()
self.zmqContext = zmq.asyncio.Context()
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
self.zmqSubSocket.setsockopt(zmq.RCVHWM, 0)
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashblock")
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashtx")
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawblock")
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawtx")
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % port)
@asyncio.coroutine
def handle(self) :
msg = yield from self.zmqSubSocket.recv_multipart()
topic = msg[0]
body = msg[1]
sequence = "Unknown"
if len(msg[-1]) == 4:
msgSequence = struct.unpack('<I', msg[-1])[-1]
sequence = str(msgSequence)
if topic == b"hashblock":
print('- HASH BLOCK ('+sequence+') -')
print(binascii.hexlify(body))
elif topic == b"hashtx":
print('- HASH TX ('+sequence+') -')
print(binascii.hexlify(body))
elif topic == b"rawblock":
print('- RAW BLOCK HEADER ('+sequence+') -')
print(binascii.hexlify(body[:80]))
elif topic == b"rawtx":
print('- RAW TX ('+sequence+') -')
print(binascii.hexlify(body))
# schedule ourselves to receive the next message
asyncio.ensure_future(self.handle())
def start(self):
self.loop.add_signal_handler(signal.SIGINT, self.stop)
self.loop.create_task(self.handle())
self.loop.run_forever()
def stop(self):
self.loop.stop()
self.zmqContext.destroy()
daemon = ZMQHandler()
daemon.start()

View file

@ -34,7 +34,7 @@ No other options are needed, the paths are automatically configured.
#### For macOS cross compilation #### For macOS cross compilation
sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python3-setuptools
#### For Win32/Win64 cross compilation #### For Win32/Win64 cross compilation

View file

@ -22,7 +22,7 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
| OpenSSL | [1.0.1k](https://www.openssl.org/source) | | Yes | | | | OpenSSL | [1.0.1k](https://www.openssl.org/source) | | Yes | | |
| PCRE | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L66) | | PCRE | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L66) |
| protobuf | [2.6.1](https://github.com/google/protobuf/releases) | | No | | | | protobuf | [2.6.1](https://github.com/google/protobuf/releases) | | No | | |
| Python (tests) | | [3.4](https://www.python.org/downloads) | | | | | Python (tests) | | [3.5](https://www.python.org/downloads) | | | |
| qrencode | [3.4.4](https://fukuchi.org/works/qrencode) | | No | | | | qrencode | [3.4.4](https://fukuchi.org/works/qrencode) | | No | | |
| Qt | [5.9.7](https://download.qt.io/official_releases/qt/) | [5.5.1](https://github.com/bitcoin/bitcoin/issues/13478) | No | | | | Qt | [5.9.7](https://download.qt.io/official_releases/qt/) | [5.5.1](https://github.com/bitcoin/bitcoin/issues/13478) | No | | |
| XCB | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L87) (Linux only) | | XCB | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L87) (Linux only) |

View file

@ -218,10 +218,7 @@ class P2PConnection(asyncio.Protocol):
def maybe_write(): def maybe_write():
if not self._transport: if not self._transport:
return return
# Python <3.4.4 does not have is_closing, so we have to check for if self._transport.is_closing():
# its existence explicitly as long as Bitcoin Core supports all
# Python 3.4 versions.
if hasattr(self._transport, 'is_closing') and self._transport.is_closing():
return return
self._transport.write(raw_message_bytes) self._transport.write(raw_message_bytes)
NetworkThread.network_event_loop.call_soon_threadsafe(maybe_write) NetworkThread.network_event_loop.call_soon_threadsafe(maybe_write)

View file

@ -449,10 +449,6 @@ 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 self.hex()
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)

View file

@ -31,9 +31,6 @@ from .util import (
p2p_port, p2p_port,
) )
# For Python 3.4 compatibility
JSONDecodeError = getattr(json, "JSONDecodeError", ValueError)
BITCOIND_PROC_WAIT_TIMEOUT = 60 BITCOIND_PROC_WAIT_TIMEOUT = 60
@ -565,5 +562,5 @@ class TestNodeCLI():
raise subprocess.CalledProcessError(returncode, self.binary, output=cli_stderr) raise subprocess.CalledProcessError(returncode, self.binary, output=cli_stderr)
try: try:
return json.loads(cli_stdout, parse_float=decimal.Decimal) return json.loads(cli_stdout, parse_float=decimal.Decimal)
except JSONDecodeError: except json.JSONDecodeError:
return cli_stdout.rstrip("\n") return cli_stdout.rstrip("\n")

View file

@ -182,9 +182,6 @@ def check_json_precision():
def count_bytes(hex_string): def count_bytes(hex_string):
return len(bytearray.fromhex(hex_string)) return len(bytearray.fromhex(hex_string))
def b_2_x(byte_str):
return byte_str.hex()
def hash256(byte_str): def hash256(byte_str):
sha256 = hashlib.sha256() sha256 = hashlib.sha256()
sha256.update(byte_str) sha256.update(byte_str)

View file

@ -15,5 +15,5 @@ fi
vulture \ vulture \
--min-confidence 60 \ --min-confidence 60 \
--ignore-names "b_2_x,argtypes,connection_lost,connection_made,converter,data_received,daemon,errcheck,get_ecdh_key,get_privkey,is_compressed,is_fullyvalid,msg_generic,on_*,optionxform,restype,set_privkey,profile_with_perf" \ --ignore-names "argtypes,connection_lost,connection_made,converter,data_received,daemon,errcheck,get_ecdh_key,get_privkey,is_compressed,is_fullyvalid,msg_generic,on_*,optionxform,restype,set_privkey,profile_with_perf" \
$(git ls-files -- "*.py" ":(exclude)contrib/" ":(exclude)test/functional/data/invalid_txs.py") $(git ls-files -- "*.py" ":(exclude)contrib/" ":(exclude)test/functional/data/invalid_txs.py")