mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Init pypy support
This commit is contained in:
parent
c801c833fc
commit
c6c6deb71f
@ -1,5 +1,5 @@
|
|||||||
ARG python_version=3.6
|
ARG python_version=3.6
|
||||||
FROM python:${python_version}
|
FROM pypy:${python_version}
|
||||||
LABEL maintainer "devs@bigchaindb.com"
|
LABEL maintainer "devs@bigchaindb.com"
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
|
|||||||
@ -5,7 +5,11 @@
|
|||||||
# Separate all crypto code so that we can easily test several implementations
|
# Separate all crypto code so that we can easily test several implementations
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import sha3
|
try:
|
||||||
|
from hashlib import sha3_256
|
||||||
|
except ImportError:
|
||||||
|
from sha3 import sha3_256
|
||||||
|
|
||||||
from cryptoconditions import crypto
|
from cryptoconditions import crypto
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +18,7 @@ CryptoKeypair = namedtuple('CryptoKeypair', ('private_key', 'public_key'))
|
|||||||
|
|
||||||
def hash_data(data):
|
def hash_data(data):
|
||||||
"""Hash the provided data using SHA3-256"""
|
"""Hash the provided data using SHA3-256"""
|
||||||
return sha3.sha3_256(data.encode()).hexdigest()
|
return sha3_256(data.encode()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def generate_key_pair():
|
def generate_key_pair():
|
||||||
|
|||||||
@ -19,6 +19,9 @@ import base58
|
|||||||
from cryptoconditions import Fulfillment, ThresholdSha256, Ed25519Sha256
|
from cryptoconditions import Fulfillment, ThresholdSha256, Ed25519Sha256
|
||||||
from cryptoconditions.exceptions import (
|
from cryptoconditions.exceptions import (
|
||||||
ParsingError, ASN1DecodeError, ASN1EncodeError, UnsupportedTypeError)
|
ParsingError, ASN1DecodeError, ASN1EncodeError, UnsupportedTypeError)
|
||||||
|
try:
|
||||||
|
from hashlib import sha3_256
|
||||||
|
except ImportError:
|
||||||
from sha3 import sha3_256
|
from sha3 import sha3_256
|
||||||
|
|
||||||
from bigchaindb.common.crypto import PrivateKey, hash_data
|
from bigchaindb.common.crypto import PrivateKey, hash_data
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -74,7 +74,7 @@ tests_require = [
|
|||||||
install_requires = [
|
install_requires = [
|
||||||
# TODO Consider not installing the db drivers, or putting them in extras.
|
# TODO Consider not installing the db drivers, or putting them in extras.
|
||||||
'pymongo~=3.6',
|
'pymongo~=3.6',
|
||||||
'pysha3~=1.0.2',
|
# 'pysha3~=1.0.2', # @PYPY: not compability with PyPy, replaced with native hashlib
|
||||||
'cryptoconditions==0.8.0',
|
'cryptoconditions==0.8.0',
|
||||||
'python-rapidjson~=0.6.0',
|
'python-rapidjson~=0.6.0',
|
||||||
'logstats~=0.2.1',
|
'logstats~=0.2.1',
|
||||||
|
|||||||
@ -11,6 +11,9 @@ from copy import deepcopy
|
|||||||
from base58 import b58encode, b58decode
|
from base58 import b58encode, b58decode
|
||||||
from cryptoconditions import Ed25519Sha256
|
from cryptoconditions import Ed25519Sha256
|
||||||
from pytest import mark, raises
|
from pytest import mark, raises
|
||||||
|
try:
|
||||||
|
from hashlib import sha3_256
|
||||||
|
except ImportError:
|
||||||
from sha3 import sha3_256
|
from sha3 import sha3_256
|
||||||
|
|
||||||
pytestmark = mark.bdb
|
pytestmark = mark.bdb
|
||||||
|
|||||||
@ -9,6 +9,9 @@ structural / schematic issues are caught when reading a transaction
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
try:
|
||||||
|
import hashlib as sha3
|
||||||
|
except ImportError:
|
||||||
import sha3
|
import sha3
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,9 @@ from unittest.mock import Mock, patch
|
|||||||
import base58
|
import base58
|
||||||
import pytest
|
import pytest
|
||||||
from cryptoconditions import Ed25519Sha256
|
from cryptoconditions import Ed25519Sha256
|
||||||
|
try:
|
||||||
|
from hashlib import sha3_256
|
||||||
|
except ImportError:
|
||||||
from sha3 import sha3_256
|
from sha3 import sha3_256
|
||||||
|
|
||||||
from bigchaindb.common import crypto
|
from bigchaindb.common import crypto
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user