@@ -642,7 +642,9 @@ def install_folder_via_pip(self, manifest: PluginManifest, verify_integrity: boo
642642 if manifest .kind == "isolated_venv" :
643643 logger .info ("Detected isolated_venv plugin from monorepo: %s" , manifest .name )
644644 # Install the package to make it available for venv initialization
645- package_path = self ._download_monorepo_folder_to_temp (repo_url , manifest .name , verify_integrity = verify_integrity )
645+ package_path = self ._download_monorepo_folder_to_temp (
646+ repo_url , manifest .name , verify_integrity = verify_integrity
647+ )
646648 plugin_path = self ._initialize_isolated_venv (manifest , package_path )
647649 logger .info ("Isolated venv initialized. Plugin will be auto-installed via requirements.txt" )
648650 else :
@@ -835,7 +837,9 @@ def _extract_package_archive(self, package_file: Path, extract_dir: Path) -> Non
835837 else :
836838 raise RuntimeError (f"Unsupported package format: { package_file } " )
837839
838- def _download_monorepo_folder_to_temp (self , repo_url : str , package_name : str , verify_integrity : bool = True ) -> Path :
840+ def _download_monorepo_folder_to_temp (
841+ self , repo_url : str , package_name : str , verify_integrity : bool = True
842+ ) -> Path :
839843 """Download monorepo folder to temporary directory.
840844
841845 Args:
@@ -873,16 +877,12 @@ def _download_monorepo_folder_to_temp(self, repo_url: str, package_name: str, ve
873877 if verify_integrity :
874878 try :
875879 from cpex .tools .integrity import compute_file_hash
880+
876881 package_hash = compute_file_hash (package_file )
877882 logger .info (
878- "Package integrity hash for %s (%s): SHA256=%s" ,
879- package_name ,
880- package_file .name ,
881- package_hash
882- )
883- logger .info (
884- "Store this hash for future verification or to detect tampering"
883+ "Package integrity hash for %s (%s): SHA256=%s" , package_name , package_file .name , package_hash
885884 )
885+ logger .info ("Store this hash for future verification or to detect tampering" )
886886 except Exception as e :
887887 logger .warning ("Failed to compute package hash: %s" , str (e ))
888888
@@ -940,14 +940,13 @@ def _download_package_to_temp(
940940 if version_constraint :
941941 # Try to extract exact version from constraint (e.g., "==1.0.0" -> "1.0.0")
942942 import re
943- version_match = re .search (r'==\s*([0-9.]+)' , version_constraint )
943+
944+ version_match = re .search (r"==\s*([0-9.]+)" , version_constraint )
944945 if version_match :
945946 version_to_fetch = version_match .group (1 )
946-
947+
947948 expected_hashes = fetch_pypi_package_hashes (
948- package_name = package_name ,
949- version = version_to_fetch ,
950- use_test = use_test
949+ package_name = package_name , version = version_to_fetch , use_test = use_test
951950 )
952951 if expected_hashes :
953952 logger .info ("Retrieved hashes for %d distribution files" , len (expected_hashes ))
@@ -988,16 +987,10 @@ def _download_package_to_temp(
988987 if expected_hash :
989988 logger .info ("Verifying integrity of %s" , package_file .name )
990989 verify_package_integrity (
991- file_path = package_file ,
992- expected_hash = expected_hash ,
993- package_name = package_name ,
994- strict = True
990+ file_path = package_file , expected_hash = expected_hash , package_name = package_name , strict = True
995991 )
996992 else :
997- logger .warning (
998- "No matching hash found for %s. Proceeding without verification." ,
999- package_file .name
1000- )
993+ logger .warning ("No matching hash found for %s. Proceeding without verification." , package_file .name )
1001994
1002995 extract_dir = temp_dir / "extracted"
1003996 extract_dir .mkdir ()
@@ -1509,16 +1502,12 @@ def install_from_git(self, url: str, verify_integrity: bool = True) -> tuple[Plu
15091502 if verify_integrity :
15101503 try :
15111504 from cpex .tools .integrity import compute_file_hash
1505+
15121506 package_hash = compute_file_hash (archive_path )
15131507 logger .info (
1514- "Package integrity hash for %s (%s): SHA256=%s" ,
1515- package_name ,
1516- archive_path .name ,
1517- package_hash
1518- )
1519- logger .info (
1520- "Store this hash for future verification or to detect tampering"
1508+ "Package integrity hash for %s (%s): SHA256=%s" , package_name , archive_path .name , package_hash
15211509 )
1510+ logger .info ("Store this hash for future verification or to detect tampering" )
15221511 except Exception as e :
15231512 logger .warning ("Failed to compute package hash: %s" , str (e ))
15241513
0 commit comments