@@ -264,22 +264,34 @@ def _verify(args: argparse.Namespace) -> None:
264264 should_exist = True ,
265265 )
266266
267+ inputs : list [Path ] = []
267268 for file_path in args .files :
268- attestation_path = Path (f"{ file_path } .publish.attestation" )
269+ # Collect only the inputs themselves, not their attestations.
270+ # Attestation paths are inferred subsequently.
271+ if file_path .name .endswith (".publish.attestation" ):
272+ _logger .warning (f"skipping attestation path while collecting file inputs: { file_path } " )
273+ continue
274+ inputs .append (file_path )
275+
276+ if not inputs :
277+ _die ("No inputs given; make sure you passed distributions and not attestations as inputs" )
278+
279+ for input in inputs :
280+ attestation_path = Path (f"{ input } .publish.attestation" )
269281 try :
270282 attestation = Attestation .model_validate_json (attestation_path .read_text ())
271283 except ValidationError as validation_error :
272- _die (f"Invalid attestation ({ file_path } ): { validation_error } " )
284+ _die (f"Invalid attestation ({ attestation_path } ): { validation_error } " )
273285
274286 try :
275- dist = Distribution .from_file (file_path )
287+ dist = Distribution .from_file (input )
276288 except ValidationError as e :
277289 _die (f"Invalid Python package distribution: { e } " )
278290
279291 try :
280292 attestation .verify (verifier , pol , dist )
281293 except VerificationError as verification_error :
282- _die (f"Verification failed for { file_path } : { verification_error } " )
294+ _die (f"Verification failed for { input } : { verification_error } " )
283295
284296 _logger .info (f"OK: { attestation_path } " )
285297
0 commit comments