|
16 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 | 17 | #
|
18 | 18 |
|
19 |
| -import sys, re, os, shutil, stat, os.path |
| 19 | +import sys, re, os, platform, shutil, stat, subprocess, os.path |
20 | 20 | from argparse import ArgumentParser
|
21 | 21 | from ds_store import DSStore
|
22 | 22 | from mac_alias import Alias
|
@@ -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:
|
@@ -543,6 +541,9 @@ ds.close()
|
543 | 541 |
|
544 | 542 | # ------------------------------------------------
|
545 | 543 |
|
| 544 | +if platform.system() == "Darwin": |
| 545 | + subprocess.check_call(f"codesign --deep --force --sign - {target}", shell=True) |
| 546 | + |
546 | 547 | if config.dmg is not None:
|
547 | 548 |
|
548 | 549 | print("+ Preparing .dmg disk image +")
|
|
0 commit comments