Skip to content

Commit c50f436

Browse files
authored
Merge pull request #5 from pipermerriam/piper/actually-use-solc-binary-argument
use the solc_binary argument (and gevent.subprocess)
2 parents a78d23d + 93566b5 commit c50f436

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gevent>=1.1.2

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
url='https://github.com/pipermerriam/py-solc',
2424
include_package_data=True,
2525
py_modules=['solc'],
26-
install_requires=[],
26+
install_requires=[
27+
"gevent>=1.1.2",
28+
],
2729
license="MIT",
2830
zip_safe=False,
2931
keywords='ethereum solidity solc',

solc/main.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
is_solc_available = functools.partial(is_executable_available, SOLC_BINARY)
2828

2929

30-
def get_solc_version():
31-
stdoutdata, stderrdata = solc_wrapper(version=True)
30+
def get_solc_version(**kwargs):
31+
kwargs['version'] = True
32+
stdoutdata, stderrdata = solc_wrapper(**kwargs)
3233
version_match = version_regex.search(stdoutdata)
3334
if version_match is None:
3435
raise SolcError(
@@ -39,7 +40,7 @@ def get_solc_version():
3940
return version_match.groups()[0]
4041

4142

42-
def _parse_compiler_output(stdoutdata):
43+
def _parse_compiler_output(stdoutdata, compiler_version):
4344

4445
output = json.loads(stdoutdata)
4546

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

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

58-
compiler_version = get_solc_version()
59-
6059
return {
6160
contract_name: {
6261
'abi': contract_data['abi'],
@@ -106,7 +105,9 @@ def compile_source(source, output_values=ALL_OUTPUT_VALUES, **kwargs):
106105
**kwargs
107106
)
108107

109-
contracts = _parse_compiler_output(stdoutdata)
108+
compiler_version = get_solc_version(version=True, **kwargs)
109+
110+
contracts = _parse_compiler_output(stdoutdata, compiler_version)
110111
return contracts
111112

112113

@@ -128,7 +129,9 @@ def compile_files(source_files, output_values=ALL_OUTPUT_VALUES, **kwargs):
128129
**kwargs
129130
)
130131

131-
contracts = _parse_compiler_output(stdoutdata)
132+
compiler_version = get_solc_version(version=True, **kwargs)
133+
134+
contracts = _parse_compiler_output(stdoutdata, compiler_version)
132135
return contracts
133136

134137

solc/wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import absolute_import
22

3-
import subprocess
3+
from gevent import subprocess
4+
45
import textwrap
56

67
from .exceptions import (
@@ -44,7 +45,7 @@ def solc_wrapper(solc_binary=SOLC_BINARY,
4445
devdoc=None,
4546
formal=None,
4647
success_return_code=0):
47-
command = ['solc']
48+
command = [solc_binary]
4849

4950
if help:
5051
command.append('--help')

0 commit comments

Comments
 (0)