@@ -703,12 +703,16 @@ fn validate_distribution(dist_path: &Path) -> Result<Vec<String>> {
703
703
// First entry in archive should be python/PYTHON.json.
704
704
let mut entries = tf. entries ( ) ?;
705
705
706
+ let mut wanted_python_paths = BTreeSet :: new ( ) ;
707
+
706
708
let mut entry = entries. next ( ) . unwrap ( ) ?;
707
709
if entry. path ( ) ?. display ( ) . to_string ( ) == "python/PYTHON.json" {
708
710
let mut data = Vec :: new ( ) ;
709
711
entry. read_to_end ( & mut data) ?;
710
712
let json = parse_python_json ( & data) . context ( "parsing PYTHON.json" ) ?;
711
713
errors. extend ( validate_json ( & json, triple) ?) ;
714
+
715
+ wanted_python_paths. extend ( json. python_paths . values ( ) . map ( |x| format ! ( "python/{}" , x) ) ) ;
712
716
} else {
713
717
errors. push ( format ! (
714
718
"1st archive entry should be for python/PYTHON.json; got {}" ,
@@ -722,6 +726,18 @@ fn validate_distribution(dist_path: &Path) -> Result<Vec<String>> {
722
726
723
727
seen_paths. insert ( path. clone ( ) ) ;
724
728
729
+ // If this path starts with a path referenced in wanted_python_paths,
730
+ // remove the prefix from wanted_python_paths so we don't error on it
731
+ // later.
732
+ let removals = wanted_python_paths
733
+ . iter ( )
734
+ . filter ( |prefix| path. starts_with ( prefix) )
735
+ . map ( |x| x. to_string ( ) )
736
+ . collect :: < Vec < _ > > ( ) ;
737
+ for p in removals {
738
+ wanted_python_paths. remove ( & p) ;
739
+ }
740
+
725
741
let mut data = Vec :: new ( ) ;
726
742
entry. read_to_end ( & mut data) ?;
727
743
@@ -761,6 +777,13 @@ fn validate_distribution(dist_path: &Path) -> Result<Vec<String>> {
761
777
}
762
778
}
763
779
780
+ for path in wanted_python_paths {
781
+ errors. push ( format ! (
782
+ "path prefix {} seen in python_paths does not appear in archive" ,
783
+ path
784
+ ) ) ;
785
+ }
786
+
764
787
let wanted_dylibs = BTreeSet :: from_iter (
765
788
allowed_dylibs_for_triple ( triple)
766
789
. iter ( )
0 commit comments