Skip to content

Commit 70eb605

Browse files
committed
Address PR review comments from elopez
- Update build command to use default behavior (builds both sdist and wheel) - Remove ISSUE_DRAFT.md (unrelated to PR) - Update README to use 'uv tool install' instead of 'uv pip install' - Remove redundant version validation (already handled by arg parser) - Remove unnecessary URL scheme validation (URLs always HTTPS from get_url) - Replace custom ARM detection with existing mac_can_run_intel_binaries() - Remove forced arch -x86_64 wrapper to let Rosetta handle automatically
1 parent 3d6cd58 commit 70eb605

File tree

4 files changed

+7
-160
lines changed

4 files changed

+7
-160
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: |
2222
python -m pip install --upgrade pip
2323
python -m pip install --upgrade build
24-
python -m build --sdist --wheel
24+
python -m build
2525
2626
- name: Upload distributions
2727
uses: actions/upload-artifact@v4

ISSUE_DRAFT.md

Lines changed: 0 additions & 131 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pip3 install solc-select
2323
### Using uv (recommended for development)
2424

2525
```bash
26-
uv pip install solc-select
26+
uv tool install solc-select
2727
```
2828

2929
To automatically install and use a version, run `solc-select use <version> --always-install`.

solc_select/solc_select.py

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ def check_emulation_available() -> bool:
5050

5151
# On macOS, check for Rosetta 2
5252
if sys.platform == "darwin":
53-
# Check if we can run x86_64 binaries
54-
try:
55-
result = subprocess.run(["arch", "-x86_64", "true"], capture_output=True, check=False)
56-
return result.returncode == 0
57-
except (FileNotFoundError, OSError):
58-
return False
53+
return mac_can_run_intel_binaries()
5954

6055
# On Linux, check for qemu-x86_64
6156
try:
@@ -72,9 +67,9 @@ def get_emulation_prefix() -> list:
7267
if get_arch() != "arm64":
7368
return []
7469

75-
# On macOS, use arch command for Rosetta 2
76-
if sys.platform == "darwin" and check_emulation_available():
77-
return ["arch", "-x86_64"]
70+
# On macOS, let Rosetta handle it automatically
71+
if sys.platform == "darwin":
72+
return []
7873

7974
# On Linux, use qemu
8075
if sys.platform.startswith("linux") and check_emulation_available():
@@ -127,11 +122,6 @@ def warn_about_arm64(force: bool = False) -> None:
127122
warning_file.touch()
128123

129124

130-
def validate_url_scheme(url: str) -> None:
131-
"""Validate that URL uses a safe scheme (http or https only)."""
132-
parsed = urlparse(url)
133-
if parsed.scheme not in ("http", "https"):
134-
raise ValueError(f"Unsafe URL scheme '{parsed.scheme}' in URL: {url}")
135125

136126

137127
def halt_old_architecture(path: Path) -> None:
@@ -234,7 +224,6 @@ def install_artifacts(versions: [str], silent: bool = False) -> bool:
234224
Path.mkdir(artifact_file_dir, parents=True, exist_ok=True)
235225
if not silent:
236226
print(f"Installing solc '{version}'...")
237-
validate_url_scheme(url)
238227
urllib.request.urlretrieve(url, artifact_file_dir.joinpath(f"solc-{version}"))
239228

240229
verify_checksum(version)
@@ -291,7 +280,6 @@ def verify_checksum(version: str) -> None:
291280
def get_soliditylang_checksums(version: str) -> (str, str):
292281
(_, list_url) = get_url(version=version)
293282
# pylint: disable=consider-using-with
294-
validate_url_scheme(list_url)
295283
list_json = urllib.request.urlopen(list_url).read()
296284
builds = json.loads(list_json)["builds"]
297285
matches = list(filter(lambda b: b["version"] == version, builds))
@@ -322,13 +310,6 @@ def switch_global_version(version: str, always_install: bool, silent: bool = Fal
322310
version = get_latest_release()
323311

324312
# Check version against platform minimum even if installed
325-
if version != "latest" and Version(version) < Version(
326-
EARLIEST_RELEASE[soliditylang_platform()]
327-
):
328-
raise argparse.ArgumentTypeError(
329-
f"Invalid version - only solc versions above '{EARLIEST_RELEASE[soliditylang_platform()]}' are available"
330-
)
331-
332313
if version in installed_versions():
333314
with open(f"{SOLC_SELECT_DIR}/global-version", "w", encoding="utf-8") as f:
334315
f.write(version)
@@ -384,14 +365,12 @@ def get_installable_versions() -> [str]:
384365
# pylint: disable=consider-using-with
385366
def get_available_versions() -> [str]:
386367
(_, list_url) = get_url()
387-
validate_url_scheme(list_url)
388368
list_json = urllib.request.urlopen(list_url).read()
389369
available_releases = json.loads(list_json)["releases"]
390370
# pylint: disable=consider-using-with
391371
if soliditylang_platform() == LINUX_AMD64:
392372
(_, list_url) = get_url(version=EARLIEST_RELEASE[LINUX_AMD64])
393-
validate_url_scheme(list_url)
394-
github_json = urllib.request.urlopen(list_url).read()
373+
github_json = urllib.request.urlopen(list_url).read()
395374
additional_linux_versions = json.loads(github_json)["releases"]
396375
available_releases.update(additional_linux_versions)
397376

@@ -412,7 +391,6 @@ def soliditylang_platform() -> str:
412391

413392
def get_latest_release() -> str:
414393
(_, list_url) = get_url()
415-
validate_url_scheme(list_url)
416394
list_json = urllib.request.urlopen(list_url).read()
417395
latest_release = json.loads(list_json)["latestRelease"]
418396
return latest_release

0 commit comments

Comments
 (0)