Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gevent>=1.1.2
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
url='https://github.com/pipermerriam/py-solc',
include_package_data=True,
py_modules=['solc'],
install_requires=[],
install_requires=[
"gevent>=1.1.2",
],
license="MIT",
zip_safe=False,
keywords='ethereum solidity solc',
Expand Down
17 changes: 10 additions & 7 deletions solc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
is_solc_available = functools.partial(is_executable_available, SOLC_BINARY)


def get_solc_version():
stdoutdata, stderrdata = solc_wrapper(version=True)
def get_solc_version(**kwargs):
kwargs['version'] = True
stdoutdata, stderrdata = solc_wrapper(**kwargs)
version_match = version_regex.search(stdoutdata)
if version_match is None:
raise SolcError(
Expand All @@ -39,7 +40,7 @@ def get_solc_version():
return version_match.groups()[0]


def _parse_compiler_output(stdoutdata):
def _parse_compiler_output(stdoutdata, compiler_version):

output = json.loads(stdoutdata)

Expand All @@ -55,8 +56,6 @@ def _parse_compiler_output(stdoutdata):

sorted_contracts = sorted(contracts.items(), key=lambda c: c[0])

compiler_version = get_solc_version()

return {
contract_name: {
'abi': contract_data['abi'],
Expand Down Expand Up @@ -106,7 +105,9 @@ def compile_source(source, output_values=ALL_OUTPUT_VALUES, **kwargs):
**kwargs
)

contracts = _parse_compiler_output(stdoutdata)
compiler_version = get_solc_version(version=True, **kwargs)

contracts = _parse_compiler_output(stdoutdata, compiler_version)
return contracts


Expand All @@ -128,7 +129,9 @@ def compile_files(source_files, output_values=ALL_OUTPUT_VALUES, **kwargs):
**kwargs
)

contracts = _parse_compiler_output(stdoutdata)
compiler_version = get_solc_version(version=True, **kwargs)

contracts = _parse_compiler_output(stdoutdata, compiler_version)
return contracts


Expand Down
5 changes: 3 additions & 2 deletions solc/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

import subprocess
from gevent import subprocess

import textwrap

from .exceptions import (
Expand Down Expand Up @@ -44,7 +45,7 @@ def solc_wrapper(solc_binary=SOLC_BINARY,
devdoc=None,
formal=None,
success_return_code=0):
command = ['solc']
command = [solc_binary]

if help:
command.append('--help')
Expand Down