@@ -756,22 +756,23 @@ def copy_build_to_webroot(self, http: urllib3.PoolManager) -> None:
756
756
target ,
757
757
])
758
758
759
- if not self .quick and (self .checkout / "Doc" / "dist" ).is_dir ():
759
+ dist_dir = self .checkout / "Doc" / "dist"
760
+ if dist_dir .is_dir ():
760
761
# Copy archive files to /archives/
761
762
logging .debug ("Copying dist files." )
762
- chgrp (self . checkout / "Doc" / "dist" , group = self .group , recursive = True )
763
- chmod_make_readable (self . checkout / "Doc" / "dist" )
764
- run ([ "mkdir" , "-m" , "o+rx" , "-p" , target / "archives" ])
765
- chgrp ( target / "archives" , group = self . group )
766
- run ([
767
- "cp" ,
768
- "-a" ,
769
- * ( self .checkout / "Doc" / "dist" ). glob ( "*" ),
770
- target / "archives" ,
771
- ] )
763
+ chgrp (dist_dir , group = self .group , recursive = True )
764
+ chmod_make_readable (dist_dir )
765
+ archives_dir = target / "archives"
766
+ archives_dir . mkdir ( parents = True , exist_ok = True )
767
+ archives_dir . chmod (
768
+ archives_dir . stat (). st_mode | stat . S_IROTH | stat . S_IXOTH
769
+ )
770
+ chgrp ( archives_dir , group = self .group )
771
+ for dist_file in dist_dir . iterdir ():
772
+ shutil . copy2 ( dist_file , archives_dir / dist_file . name )
772
773
changed .append ("archives/" )
773
- for file in ( target / "archives" ) .iterdir ():
774
- changed .append ("archives/" + file .name )
774
+ for file in archives_dir .iterdir ():
775
+ changed .append (f "archives/{ file .name } " )
775
776
776
777
logging .info ("%s files changed" , len (changed ))
777
778
if changed and not self .skip_cache_invalidation :
0 commit comments