Skip to content

Commit

Permalink
fix: verified and installed is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
alan890104 committed Apr 7, 2023
1 parent 53129d0 commit 9efef55
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 188 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Solcix

[![Version](https://img.shields.io/pypi/v/solcix?color=brightgreen)](https://pypi.org/project/solcix?style=flat) [![Release](https://img.shields.io/github/v/release/Solratic/solcix?include_prereleases?color=brightgreen)](https://github.com/Solratic/solcix) [![Code Style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black) [![Python Versions](https://img.shields.io/pypi/pyversions/solcix?style=flat)](https://pypi.org/project/solcix/) [![Activity](https://img.shields.io/github/commit-activity/w/Solratic/solcix?color=orange)](https://github.com/Solratic/solcix)
[![Version](https://img.shields.io/pypi/v/solcix?color=green)](https://pypi.org/project/solcix?style=flat) [![Release](https://img.shields.io/github/v/release/Solratic/solcix?color=green)](https://github.com/Solratic/solcix) [![Python Versions](https://img.shields.io/pypi/pyversions/solcix?style=flat&color=306998)](https://pypi.org/project/solcix/) [![Code Style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black) [![Activity](https://img.shields.io/github/commit-activity/w/Solratic/solcix?color=yellow)](https://github.com/Solratic/solcix) [![License](https://img.shields.io/github/license/Solratic/solcix?style=flat&color=orange)](https://github.com/Solratic/solcix/blob/main/LICENSE)

Solcix is a Solidity version manager written in Python that allows for seamless switching between versions, easy compilation, and simple management of artifacts.

Expand Down Expand Up @@ -44,6 +44,14 @@ Uses the [pipenv](https://pipenv.pypa.io/en/latest/) package manager to install
pipenv install solcix
```

### With pip for main branch

You can also install solcix from github main branch:

```bash
pip install git+https://github.com/Solratic/solcix.git@main
```

## Enable Auto-Completion

Enable auto-completion for `solcix` by running the following command:
Expand Down Expand Up @@ -89,7 +97,7 @@ The `install` command can be used to install one or more versions of the Solidit
Example usage:

```bash
solcix install 0.8.4 0.7.6
solcix install 0.8.4 0.7.6 latest
```

### Listing installed Solidity compilers
Expand Down Expand Up @@ -134,6 +142,11 @@ solcix use global 0.8.16
solcix use local 0.8.16
```

```bash
# You can also use the alias `latest` to use the latest version
solcix use global latest
```

Simply run the command will see the changes:

```bash
Expand Down
174 changes: 1 addition & 173 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "solcix"
version = "0.1.5"
version = "0.1.6"
description = "A Python wrapper for the Solidity compiler. Switch between versions, compile, and manage artifacts."
authors = ["alan890104 <[email protected]>"]
readme = "README.md"
Expand Down Expand Up @@ -29,7 +29,6 @@ pyfiglet = "^0.8.post1"
[tool.poetry.group.dev.dependencies]
black = "23.3.0"
pre-commit = "^3.2.2"
pytest-cov = "^4.0.0"

[tool.poetry.scripts]
solcix = "solcix.__main__:cli"
Expand Down
3 changes: 2 additions & 1 deletion solcix/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def installed():
for version in installed:
if current == version:
print(Fore.GREEN + f"{version} <- current" + Style.RESET_ALL)
print(version)
else:
print(version)
except NotInstalledError as e:
print(Fore.YELLOW + f"{e}" + Style.RESET_ALL)
for version in installed:
Expand Down
25 changes: 15 additions & 10 deletions solcix/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from glob import glob
from os import access, makedirs
from pathlib import Path
from typing import Iterable, List, Tuple, Union, Optional, Set, Dict, Any
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union
from urllib.request import urlopen, urlretrieve
from zipfile import ZipFile

Expand All @@ -16,9 +16,9 @@

from solcix.constant import (
ARTIFACT_DIR,
SOLCIX_DIR,
CRYTIC_SOLC_ARTIFACTS,
CRYTIC_SOLC_JSON,
SOLCIX_DIR,
EarliestRelease,
Platform,
)
Expand All @@ -27,10 +27,12 @@
ChecksumMismatchError,
ChecksumMissingError,
NoSolcVersionInstalledError,
UnsupportedPlatformError,
NotInstalledError,
UnsupportedPlatformError,
)

from .utils import is_valid_version

cachedir = ARTIFACT_DIR.joinpath(".solcix", "cache")
os.makedirs(cachedir, exist_ok=True)
memory = Memory(cachedir, verbose=0)
Expand Down Expand Up @@ -353,16 +355,19 @@ def verify_solc(
"""
if isinstance(version, str):
version = [version]
_, latest = get_available_versions()
version = [latest if v == "latest" else v for v in version]
fixs = []
for v in version:
try:
v = Version(v)
_verify_checksum(v)
except AssertionError:
if verbose:
print(
f"Since solc-{v} is not a valid version, checksum verification is skipped."
)
if is_valid_version(v):
_verify_checksum(v)
print(f"Checksum verification passed for solc-{v}.")
else:
if verbose:
print(
f"Since solc-{v} is not a valid version, checksum verification is skipped."
)
except ChecksumMismatchError:
if reinstall:
fixs.append(v)
Expand Down

0 comments on commit 9efef55

Please sign in to comment.