@@ -60,6 +60,7 @@ class Uploader:
6060
6161 upload_host = _profile_key ('upload_host' )
6262 _profile = Loader ().nnprofile
63+ _macos_compatibility = False
6364
6465 def get_relative_path (self , output_path ):
6566 """Return the relative path to the ``target_dir``."""
@@ -100,24 +101,38 @@ def check_rsync(self):
100101 """Check that the rsync command exists"""
101102 if not shutil .which ('rsync' ):
102103 raise BadSSH ("Could not find the rsync command. Please make sure it is installed." )
104+ if shutil .which ("sw_vers" ) and not self ._macos_compatibility :
105+ # In Mac 15.4 Sequoia rsync was swapped by openrsync and permissions work differently
106+ # we need to swap permissions in the output file manually
107+ cmd = ("sw_vers" , "--productVersion" )
108+ macV = subprocess .run (cmd , capture_output = True , text = True ).stdout .strip ()
109+ if macV >= "15.4" :
110+ self ._macos_compatibility = True
103111
104112 def upload_output (self , output_path ):
105113 """Rsync ``output_path`` to the server and print the resulting URL. If
106114 specific_file is given"""
115+ pout = pathlib .Path (output_path )
107116 # Set the date to now
108- pathlib .Path (output_path ).touch ()
117+ pout .touch ()
118+ if self ._macos_compatibility :
119+ # Set the permission of the upload folder/file to ug+rwx,o+rx
120+ pout .chmod (0o775 )
121+ for p in pout .rglob ("*" ):
122+ p .chmod (0o775 )
123+
109124 randname = self .get_relative_path (output_path )
110125 newdir = self .target_dir + randname
111126
112127 rsync_command = (
113128 'rsync' ,
114129 '-aLz' ,
115130 '--chmod=ug=rwx,o=rx' ,
116- f"{ output_path } /" ,
131+ f"{ pout . as_posix () } /" ,
117132 f"{ self .upload_host } :{ newdir } " ,
118133 )
119134
120- log .info (f"Uploading output ({ output_path } ) to { self .upload_host } " )
135+ log .info (f"Uploading output ({ pout } ) to { self .upload_host } " )
121136 try :
122137 subprocess .run (rsync_command , check = True )
123138 except subprocess .CalledProcessError as e :
@@ -132,8 +147,8 @@ def _print_output(self, name):
132147 def check_upload (self ):
133148 """Check that it looks possible to upload something.
134149 Raise an UploadError if not."""
135- self .check_rsync ()
136150 self .check_auth ()
151+ self .check_rsync ()
137152
138153 @contextlib .contextmanager
139154 def upload_context (self , output ):
0 commit comments