@@ -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
137127def 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:
291280def 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
385366def 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
413392def 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