Skip to content

Commit

Permalink
Merge pull request #221 from crytic/dev-pyproject
Browse files Browse the repository at this point in the history
Replace `setup.py` with `pyproject.toml`
  • Loading branch information
elopez authored Jan 3, 2025
2 parents c16d61f + ff28aa6 commit 5fe9d26
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 50 deletions.
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "solc-select"
version = "1.0.4"
dependencies = [
"pycryptodome>=3.4.6",
"packaging",
]
requires-python = ">= 3.8"
authors = [
{name = "Trail of Bits", email = "[email protected]"},
]
maintainers = [
{name = "Trail of Bits", email = "[email protected]"},
]
description = "Manage multiple Solidity compiler versions."
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["solc", "solidity", "ethereum", "compiler", "version manager"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Compilers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.urls]
Homepage = "https://github.com/crytic/solc-select"
Repository = "https://github.com/crytic/solc-select.git"
Issues = "https://github.com/crytic/solc-select/issues"

[project.scripts]
solc-select = "solc_select.__main__:solc_select"
solc = "solc_select.__main__:solc"

[tool.black]
target-version = ["py38"]
line-length = 100
Expand Down
7 changes: 4 additions & 3 deletions scripts/test_linux.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

sudo python3 setup.py install
sudo pip3 install .
solc-select install all

use_version=$(solc-select use 0.4.0)
Expand All @@ -19,14 +20,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then
fi
echo "LINUX SUCCESS: maximum version"

use_version=$(solc-select use 0.3.9 2>&1)
use_version=$(solc-select use 0.3.9 2>&1 || true)
if [[ $use_version != *"Invalid version - only solc versions above '0.4.0' are available"* ]]; then
echo "LINUX FAILED: version too low"
exit 255
fi
echo "LINUX SUCCESS: version too low"

use_version=$(solc-select use 0.100.8 2>&1)
use_version=$(solc-select use 0.100.8 2>&1 || true)
if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then
echo "LINUX FAILED: version too high"
exit 255
Expand Down
5 changes: 3 additions & 2 deletions scripts/test_macos.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

use_version=$(solc-select use 0.3.6)
if [[ $use_version != "Switched global version to 0.3.6"* ]]; then
Expand All @@ -16,14 +17,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then
fi
echo "OS X SUCCESS: set maximum version"

use_version=$(solc-select use 0.3.5 2>&1)
use_version=$(solc-select use 0.3.5 2>&1 || true)
if [[ $use_version != *"Invalid version - only solc versions above '0.3.6' are available"* ]]; then
echo "OS X FAILED: version too low"
exit 255
fi
echo "OS X SUCCESS: version too low"

use_version=$(solc-select use 0.100.8 2>&1)
use_version=$(solc-select use 0.100.8 2>&1 || true)
if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then
echo "OS X FAILED: version too high"
exit 255
Expand Down
31 changes: 14 additions & 17 deletions scripts/test_solc.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail

## solc 0.4.5 ##
solc-select use 0.4.5 &> /dev/null
solc ./scripts/solidity_tests/solc045_success.sol
Expand All @@ -8,7 +11,7 @@ if [[ $? != 0 ]]; then
fi
echo "SUCCESS: solc045_success"

execute=$(solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1)
execute=$(solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1 || true)
if [[ "$execute" != *"Error: Expected token Semicolon got 'Function'"* ]]; then
echo "FAILED: solc045_fail_compile"
echo "$execute"
Expand All @@ -26,7 +29,7 @@ if [[ $? != 0 ]]; then
fi
echo "SUCCESS: solc050_success"

execute=$(solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1)
execute=$(solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1 || true)
if [[ "$execute" != *"Error: Functions are not allowed to have the same name as the contract."* ]]; then
echo "FAILED: solc050_fail_compile"
exit 255
Expand All @@ -35,17 +38,14 @@ echo "SUCCESS: solc050_fail_compile"

## solc 0.6.0 ##
solc-select use 0.6.0 &> /dev/null
solc ./scripts/solidity_tests/solc060_success_trycatch.sol

if [[ $? != 0 ]]; then
if ! solc ./scripts/solidity_tests/solc060_success_trycatch.sol; then
echo "FAILED: solc060_success_trycatch" $?
exit 255
fi
echo "SUCCESS: solc060_success_trycatch"

solc ./scripts/solidity_tests/solc060_success_receive.sol

if [[ $? != 0 ]]; then
if ! solc ./scripts/solidity_tests/solc060_success_receive.sol; then
echo "FAILED: solc060_success_receive" $?
exit 255
fi
Expand All @@ -54,39 +54,36 @@ echo "SUCCESS: solc060_success_receive"
## solc 0.7.0 ##
solc-select use 0.7.0 &> /dev/null

execute=$(solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1)
execute=$(solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1 || true)
if [[ "$execute" != *"\"now\" has been deprecated."* ]]; then
echo "FAILED: solc070_fail_compile" "$execute"
exit 255
fi
echo "SUCCESS: solc070_fail_compile"

solc ./scripts/solidity_tests/solc070_success.sol

if [[ $? != 0 ]]; then
if ! solc ./scripts/solidity_tests/solc070_success.sol; then
echo "FAILED: solc070_success" $?
exit 255
fi
echo "SUCCESS: solc070_success"

## solc 0.8.0 ##
solc-select use 0.8.0 &> /dev/null
solc ./scripts/solidity_tests/solc080_success.sol

if [[ $? != 0 ]]; then
if ! solc ./scripts/solidity_tests/solc080_success.sol; then
echo "FAILED: solc080_success" $?
exit 255
fi
echo "SUCCESS: solc080_success"

execute=$(solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1)
execute=$(solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1 || true)
if [[ "$execute" != *"Warning: Function state mutability can be restricted to pure"* ]]; then
echo "FAILED: solc080_success_warning"
exit 255
fi
echo "SUCCESS: solc080_success_warning"

execute=$(solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1)
execute=$(solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1 || true)
if [[ "$execute" != *"Error: Explicit type conversion not allowed"* ]]; then
echo "FAILED: solc080_fail_compile"
exit 255
Expand All @@ -100,11 +97,11 @@ if [[ "$execute" != *"Switched global version to 0.8.9"* ]]; then
echo "FAILED: use - always install"
exit 255
fi
echo "SUCCESS: use - always install"
echo "SUCCESS: use - always install"

UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.1
rm -rf $UNINSTALL_PATH # uninstall solc 0.8.1
execute=$(solc-select use 0.8.1 2>&1)
execute=$(solc-select use 0.8.1 2>&1 || true)
if [[ $execute != *"'0.8.1' must be installed prior to use"* ]]; then
echo "FAILED: use - no install"
exit 255
Expand Down
10 changes: 6 additions & 4 deletions scripts/test_solc_upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

### Install old version of solc
sudo pip3 uninstall solc-select
sudo pip3 uninstall --yes solc-select
sudo pip3 install solc-select
solc-select use 0.8.0 --always-install
old_solc_version=$(solc --version)
solc-select install 0.4.11 0.5.0 0.6.12 0.7.3 0.8.3
all_old_versions=$(solc-select versions)
all_old_versions=$(solc-select versions | sort)

### Install new version of solc
sudo python3 setup.py develop
sudo pip3 install -e .
new_solc_version=$(solc --version)
all_new_versions=$(solc-select versions)
all_new_versions=$(solc-select versions | sort)

### halt if solc version is accidentally changed
if [ "$old_solc_version" != "$new_solc_version" ]; then
Expand Down
5 changes: 3 additions & 2 deletions scripts/test_windows.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

use_version=$(solc-select use 0.4.5)
if [[ $use_version != "Switched global version to 0.4.5"* ]]; then
Expand All @@ -16,14 +17,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then
fi
echo "WINDOWS SUCCESS: maximum version"

use_version=$(solc-select use 0.3.9 2>&1)
use_version=$(solc-select use 0.3.9 2>&1 || true)
if [[ $use_version != *"Invalid version - only solc versions above '0.4.5' are available"* ]]; then
echo "WINDOWS FAILED: version too low"
exit 255
fi
echo "WINDOWS SUCCESS: version too low"

use_version=$(solc-select use 0.100.8 2>&1)
use_version=$(solc-select use 0.100.8 2>&1 || true)
if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then
echo "WINDOWS FAILED: version too high"
exit 255
Expand Down
22 changes: 0 additions & 22 deletions setup.py

This file was deleted.

0 comments on commit 5fe9d26

Please sign in to comment.