@@ -244,49 +244,47 @@ def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional
244
244
fromPath = framework .sourceFilePath
245
245
toDir = os .path .join (path , framework .destinationDirectory )
246
246
toPath = os .path .join (toDir , framework .binaryName )
247
-
248
- if not os .path .exists (fromPath ):
249
- raise RuntimeError (f"No file at { fromPath } " )
250
-
251
- if os .path .exists (toPath ):
252
- return None # Already there
253
-
254
- if not os .path .exists (toDir ):
255
- os .makedirs (toDir )
256
-
257
- shutil .copy2 (fromPath , toPath )
258
- if verbose :
259
- print ("Copied:" , fromPath )
260
- print (" to:" , toPath )
247
+
248
+ if framework .isDylib ():
249
+ if not os .path .exists (fromPath ):
250
+ raise RuntimeError (f"No file at { fromPath } " )
251
+
252
+ if os .path .exists (toPath ):
253
+ return None # Already there
254
+
255
+ if not os .path .exists (toDir ):
256
+ os .makedirs (toDir )
257
+
258
+ shutil .copy2 (fromPath , toPath )
259
+ if verbose :
260
+ print ("Copied:" , fromPath )
261
+ print (" to:" , toPath )
262
+ else :
263
+ to_dir = os .path .join (path , "Contents" , "Frameworks" , framework .frameworkName )
264
+ if os .path .exists (to_dir ):
265
+ return None # Already there
266
+
267
+ from_dir = framework .frameworkPath
268
+ if not os .path .exists (from_dir ):
269
+ raise RuntimeError (f"No directory at { from_dir } " )
270
+
271
+ shutil .copytree (from_dir , to_dir , symlinks = True )
272
+ if verbose :
273
+ print ("Copied:" , from_dir )
274
+ print (" to:" , to_dir )
275
+
276
+ headers_link = os .path .join (to_dir , "Headers" )
277
+ if os .path .exists (headers_link ):
278
+ os .unlink (headers_link )
279
+
280
+ headers_dir = os .path .join (to_dir , framework .binaryDirectory , "Headers" )
281
+ if os .path .exists (headers_dir ):
282
+ shutil .rmtree (headers_dir )
261
283
262
284
permissions = os .stat (toPath )
263
285
if not permissions .st_mode & stat .S_IWRITE :
264
286
os .chmod (toPath , permissions .st_mode | stat .S_IWRITE )
265
287
266
- if not framework .isDylib (): # Copy resources for real frameworks
267
-
268
- linkfrom = os .path .join (path , "Contents" ,"Frameworks" , framework .frameworkName , "Versions" , "Current" )
269
- linkto = framework .version
270
- if not os .path .exists (linkfrom ):
271
- os .symlink (linkto , linkfrom )
272
- print ("Linked:" , linkfrom , "->" , linkto )
273
- fromResourcesDir = framework .sourceResourcesDirectory
274
- if os .path .exists (fromResourcesDir ):
275
- toResourcesDir = os .path .join (path , framework .destinationResourcesDirectory )
276
- shutil .copytree (fromResourcesDir , toResourcesDir , symlinks = True )
277
- if verbose :
278
- print ("Copied resources:" , fromResourcesDir )
279
- print (" to:" , toResourcesDir )
280
- fromContentsDir = framework .sourceVersionContentsDirectory
281
- if not os .path .exists (fromContentsDir ):
282
- fromContentsDir = framework .sourceContentsDirectory
283
- if os .path .exists (fromContentsDir ):
284
- toContentsDir = os .path .join (path , framework .destinationVersionContentsDirectory )
285
- shutil .copytree (fromContentsDir , toContentsDir , symlinks = True )
286
- if verbose :
287
- print ("Copied Contents:" , fromContentsDir )
288
- print (" to:" , toContentsDir )
289
-
290
288
return toPath
291
289
292
290
def deployFrameworks (frameworks : List [FrameworkInfo ], bundlePath : str , binaryPath : str , strip : bool , verbose : int , deploymentInfo : Optional [DeploymentInfo ] = None ) -> DeploymentInfo :
0 commit comments