Skip to content

Commit 54bc906

Browse files
committed
improved tox solc checker to be able to find locally installed version in path and use that one if it is 0.8.24 instead of downloading it which does not work on arm
1 parent c31efcc commit 54bc906

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

tox.ini

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,52 @@ allowlist_externals =
7979
chmod
8080
test
8181
solc
82+
grep
8283
commands_pre =
8384
# Create bin directory
8485
mkdir -p {envdir}/bin
85-
# Download platform-specific solc
86-
sh -c 'if [ "$(uname)" = "Darwin" ]; then \
86+
# if solc 0.8.24 exists already we are done, otherwise download it and verify version equals 0.8.24 (will fail on linux-arm64)
87+
sh -c 'echo "Checking for system solc..."; \
88+
if command -v solc >/dev/null 2>&1; then \
89+
SYSTEM_SOLC=$(command -v solc); \
90+
echo "Found solc at $SYSTEM_SOLC"; \
91+
VERSION_OUTPUT=$("$SYSTEM_SOLC" --version 2>&1); \
92+
echo "Found solc version:"; \
93+
echo "$VERSION_OUTPUT"; \
94+
if echo "$VERSION_OUTPUT" | grep -q "Version: 0\.8\.24"; then \
95+
echo "System solc is correct version, copying to tox env..."; \
96+
mkdir -p {envdir}/bin; \
97+
cp "$SYSTEM_SOLC" {envdir}/bin/solc; \
98+
exit 0; \
99+
else \
100+
echo "This is not the correct version, expected 0.8.24."; \
101+
fi; \
102+
fi; \
103+
for dir in "{envdir}/bin" "{envdir}/local/bin"; do \
104+
if [ -x "$dir/solc" ]; then \
105+
echo "Found solc at $dir/solc"; \
106+
VERSION_OUTPUT=$("$dir/solc" --version 2>&1); \
107+
echo "Found solc version:"; \
108+
echo "$VERSION_OUTPUT"; \
109+
if echo "$VERSION_OUTPUT" | grep -q "Version: 0\.8\.24"; then \
110+
exit 0; \
111+
else \
112+
echo "This is not the correct version, expected 0.8.24."; \
113+
fi; \
114+
fi; \
115+
done; \
116+
echo "Downloading solc 0.8.24..."; \
117+
mkdir -p {envdir}/bin; \
118+
if [ "$(uname)" = "Darwin" ]; then \
87119
curl -L -o {envdir}/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.24/solc-macos; \
88120
else \
89121
curl -L -o {envdir}/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.24/solc-static-linux; \
90-
fi;'
91-
# Make it executable
92-
chmod +x {envdir}/bin/solc
93-
# Verify it works
94-
solc --version
122+
fi; \
123+
chmod +x {envdir}/bin/solc; \
124+
echo "Downloaded solc to {envdir}/bin/solc"; \
125+
echo "Verifying installation..."; \
126+
{envdir}/bin/solc --version'
127+
95128
commands =
96129
pytest -c ./pytest-framework.ini -n auto -m "not run_in_serial"
97130
pytest -c ./pytest-framework.ini -m run_in_serial

0 commit comments

Comments
 (0)