Skip to content

Commit

Permalink
allow no console output when changing solc version
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Jul 14, 2019
1 parent 691553b commit 90a56a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion solcx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@

# default to latest version
if get_installed_solc_versions():
set_solc_version(get_installed_solc_versions()[-1])
set_solc_version(get_installed_solc_versions()[-1], silent=True)
12 changes: 7 additions & 5 deletions solcx/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ def get_executable(version=None):
return str(solc_bin)


def set_solc_version(version):
def set_solc_version(version, silent=False):
version = _check_version(version)
get_executable(version)
global solc_version
solc_version = version
print("Using solc version {}".format(solc_version))
if not silent:
print("Using solc version {}".format(solc_version))


def set_solc_version_pragma(version):
def set_solc_version_pragma(version, silent=False):
version = version.strip()
comparator_set_range = [i.strip() for i in version.split('||')]
installed_versions = get_installed_solc_versions()
Expand All @@ -126,14 +127,15 @@ def set_solc_version_pragma(version):
if range_flag:
set_version = installed_version
newer_version = install_solc_pragma(version, install=False)
if _compare_versions(set_version, newer_version, '<'):
if not silent and _compare_versions(set_version, newer_version, '<'):
print("Newer compatible solc version exists: {}".format(newer_version))
break
if not set_version:
set_version = install_solc_pragma(version)
global solc_version
solc_version = set_version
print("Using solc version {}".format(solc_version))
if not silent:
print("Using solc version {}".format(solc_version))


def get_available_solc_versions():
Expand Down
1 change: 0 additions & 1 deletion solcx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import semantic_version



VERSION_DEV_DATE_MANGLER_RE = re.compile(r'(\d{4})\.0?(\d{1,2})\.0?(\d{1,2})')
strip_zeroes_from_month_and_day = functools.partial(VERSION_DEV_DATE_MANGLER_RE.sub,
r'\g<1>.\g<2>.\g<3>')
Expand Down

0 comments on commit 90a56a7

Please sign in to comment.