mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Remove pysha3 for python >= 3.6 (#2652)
* Init pypy support * Fixed setup
This commit is contained in:
parent
df23bec320
commit
2975c372c8
@ -33,4 +33,4 @@ RUN mkdir -p /usr/src/app
|
||||
COPY . /usr/src/app/
|
||||
WORKDIR /usr/src/app
|
||||
RUN pip install -e .[dev]
|
||||
RUN bigchaindb -y configure
|
||||
RUN bigchaindb -y configure
|
||||
|
@ -5,7 +5,11 @@
|
||||
# Separate all crypto code so that we can easily test several implementations
|
||||
from collections import namedtuple
|
||||
|
||||
import sha3
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
|
||||
from cryptoconditions import crypto
|
||||
|
||||
|
||||
@ -14,7 +18,7 @@ CryptoKeypair = namedtuple('CryptoKeypair', ('private_key', 'public_key'))
|
||||
|
||||
def hash_data(data):
|
||||
"""Hash the provided data using SHA3-256"""
|
||||
return sha3.sha3_256(data.encode()).hexdigest()
|
||||
return sha3_256(data.encode()).hexdigest()
|
||||
|
||||
|
||||
def generate_key_pair():
|
||||
|
@ -19,7 +19,10 @@ import base58
|
||||
from cryptoconditions import Fulfillment, ThresholdSha256, Ed25519Sha256
|
||||
from cryptoconditions.exceptions import (
|
||||
ParsingError, ASN1DecodeError, ASN1EncodeError, UnsupportedTypeError)
|
||||
from sha3 import sha3_256
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
|
||||
from bigchaindb.common.crypto import PrivateKey, hash_data
|
||||
from bigchaindb.common.exceptions import (KeypairMismatchException,
|
||||
|
4
setup.py
4
setup.py
@ -74,7 +74,6 @@ tests_require = [
|
||||
install_requires = [
|
||||
# TODO Consider not installing the db drivers, or putting them in extras.
|
||||
'pymongo~=3.6',
|
||||
'pysha3~=1.0.2',
|
||||
'cryptoconditions==0.8.0',
|
||||
'python-rapidjson~=0.6.0',
|
||||
'logstats~=0.2.1',
|
||||
@ -91,6 +90,9 @@ install_requires = [
|
||||
'packaging~=18.0',
|
||||
]
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
install_requires.append('pysha3~=1.0.2')
|
||||
|
||||
setup(
|
||||
name='BigchainDB',
|
||||
version=version['__version__'],
|
||||
|
@ -11,7 +11,10 @@ from copy import deepcopy
|
||||
from base58 import b58encode, b58decode
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
from pytest import mark, raises
|
||||
from sha3 import sha3_256
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
|
||||
pytestmark = mark.bdb
|
||||
|
||||
|
@ -9,7 +9,10 @@ structural / schematic issues are caught when reading a transaction
|
||||
import json
|
||||
|
||||
import pytest
|
||||
import sha3
|
||||
try:
|
||||
import hashlib as sha3
|
||||
except ImportError:
|
||||
import sha3
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from bigchaindb.common.exceptions import (AmountError,
|
||||
|
@ -8,7 +8,10 @@ from unittest.mock import Mock, patch
|
||||
import base58
|
||||
import pytest
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
from sha3 import sha3_256
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user