Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:ethereum/pyethereum into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
vub authored and vub committed Dec 21, 2015
2 parents bc59edb + 613b25e commit 6bfc645
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 22 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ script:

after_success:
- coveralls

deploy:
provider: pypi
user: ethereum_pypi_automated
password:
secure: "FvkEn1xULi9mGxAL9sKlTuxJZvk0Uyd2GaDPAHN5ZAfaJUNwzA6+m7PRAMPd44Uy/LOw0+Ah9X1rxAxZc+7yx+FJjwH1Nl8MjtqYTWp+Ue6TFUNdJXNHjekC5ce4rbULudrqlmwmaWzi5iRC7qhpxuTg1y3iBw3Fsd8E82qbDac="
on:
tags: true
repo: ethereum/pyethereum
branch: develop
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ tox
coveralls
pytest
pytest-catchlog==1.1
pytest-timeout
pytest-timeout==0.5
https://github.com/ethereum/serpent/tarball/develop
32 changes: 27 additions & 5 deletions ethereum/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
# -*- coding: utf-8 -*-
# ############# version ##################
from pkg_resources import get_distribution, DistributionNotFound
import os.path
import subprocess
import re


GIT_DESCRIBE_RE = re.compile('^(?P<version>v\d+\.\d+\.\d+)-(?P<git>\d+-g[a-fA-F0-9]+(?:-dirty)?)$')


__version__ = None
try:
_dist = get_distribution('ethereum')
_dist = get_distribution('pyethapp')
# Normalize case for Windows systems
dist_loc = os.path.normcase(_dist.location)
here = os.path.normcase(__file__)
if not here.startswith(os.path.join(dist_loc, 'ethereum')):
if not here.startswith(os.path.join(dist_loc, 'pyethapp')):
# not installed, but there is another version that *is*
raise DistributionNotFound
except DistributionNotFound:
__version__ = 'Please install this project with setup.py'
else:
__version__ = _dist.version
except DistributionNotFound:
pass

if not __version__:
try:
rev = subprocess.check_output(['git', 'describe', '--tags', '--dirty'],
stderr=subprocess.STDOUT)
match = GIT_DESCRIBE_RE.match(rev)
if match:
__version__ = "{}+git-{}".format(match.group("version"), match.group("git"))
except:
pass

if not __version__:
__version__ = 'undefined'

# ########### endversion ##################

'''from ethereum import utils
Expand Down
8 changes: 5 additions & 3 deletions ethereum/ethash_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import sha3
from Crypto.Hash import keccak
sha3_256 = lambda x: keccak.new(digest_bits=256, data=x)
sha3_512 = lambda x: keccak.new(digest_bits=512, data=x)
from rlp.utils import decode_hex, encode_hex
import sys

Expand Down Expand Up @@ -59,11 +61,11 @@ def to_bytes(x):

# sha3 hash function, outputs 64 bytes
def sha3_512(x):
return hash_words(lambda v: sha3.sha3_512(to_bytes(v)).digest(), 64, x)
return hash_words(sha3_512(to_bytes(v)).digest(), 64, x)


def sha3_256(x):
return hash_words(lambda v: sha3.sha3_256(to_bytes(v)).digest(), 32, x)
return hash_words(sha3_256(to_bytes(v)).digest(), 32, x)


def xor(a, b):
Expand Down
4 changes: 2 additions & 2 deletions ethereum/ethpow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time
import sys
import sha3
import warnings
from collections import OrderedDict
from ethereum.slogging import get_logger

Expand All @@ -15,10 +16,9 @@
try:
import pyethash
ETHASH_LIB = 'pyethash' # the C++ based implementation
log.warn('using C++ implementation')
except ImportError:
ETHASH_LIB = 'ethash'
log.warn('using pure python implementation')
warnings.warn('using pure python implementation', ImportWarning)

if ETHASH_LIB == 'ethash':
mkcache = ethash.mkcache
Expand Down
3 changes: 2 additions & 1 deletion ethereum/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import binascii
import struct
from math import ceil
from sha3 import sha3_256
from Crypto.Hash import keccak
sha3_256 = lambda x: keccak.new(digest_bits=256, data=x)
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto.Util import Counter
Expand Down
2 changes: 1 addition & 1 deletion ethereum/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def intrinsic_gas_used(self):
@property
def creates(self):
"returns the address of a contract created by this tx"
if self.to == '':
if self.to in (b'', '\0'*20):
return mk_contract_address(self.sender, self.nonce)


Expand Down
7 changes: 2 additions & 5 deletions ethereum/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
try:
from keccak import sha3_256 # pypy
except ImportError:
from sha3 import sha3_256 as _sha3_256
sha3_256 = lambda x: _sha3_256(x).digest()
from Crypto.Hash import keccak
sha3_256 = lambda x: keccak.new(digest_bits=256, data=x).digest()
from bitcoin import privtopub
import sys
import rlp
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pysha3
PyYAML
repoze.lru
pbkdf2
pycrypto
pycryptodome>=3.3.1
scrypt
https://github.com/ethereum/pyrlp/tarball/develop
rlp==0.4.4
https://github.com/ethereum/ethash/tarball/master
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[bumpversion]
current_version = 1.0.8
commit = True
tag = True

[bumpversion:file:setup.py]
search = version = "{current_version}"

6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def run_tests(self):
# requirements
install_requires = set(x.strip() for x in open('requirements.txt'))
install_requires_replacements = {
'https://github.com/ethereum/pyrlp/tarball/develop': 'rlp>=0.3.9',
'https://github.com/ethereum/ethash/tarball/master': 'pyethash'}
install_requires = [install_requires_replacements.get(r, r) for r in install_requires]

Expand All @@ -42,6 +41,9 @@ def run_tests(self):
'https://github.com/ethereum/serpent/tarball/develop': 'ethereum-serpent>=1.8.1'}
tests_require = [tests_require_replacements.get(r, r) for r in tests_require]

# *IMPORTANT*: Don't manually change the version here. Use the 'bumpversion' utility.
# see: https://github.com/ethereum/pyethapp/wiki/Development:-Versions-and-Releases
version = '1.0.8'

setup(name="ethereum",
packages=find_packages("."),
Expand All @@ -51,6 +53,6 @@ def run_tests(self):
install_requires=install_requires,
tests_require=tests_require,
entry_points=dict(console_scripts=console_scripts),
version='1.0.6',
version=version,
cmdclass=cmdclass
)

0 comments on commit 6bfc645

Please sign in to comment.