Skip to content

Commit

Permalink
bdist_mac: create symlink between folders specified by user under Res…
Browse files Browse the repository at this point in the history
…ources (#2169)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Marcelo Duarte <marcelotduarte@users.noreply.github.com>
  • Loading branch information
3 people committed Dec 18, 2023
1 parent 6bf89af commit e9c2e34
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions cx_Freeze/command/bdist_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,28 +429,19 @@ def run(self):
target = os.path.join(self.bin_dir, executable.target_name)
self.move_file(source, target)

# Make symlink between Resources/lib and Contents/MacOS so we can use
# none-relative reference paths in order to pass codesign...
resources_lib_dir = os.path.join(self.resources_dir, "lib")
origin = os.path.join(self.bin_dir, "lib")
relative_reference = os.path.relpath(resources_lib_dir, self.bin_dir)
self.execute(
os.symlink,
(relative_reference, origin, True),
msg=f"linking {origin} -> {relative_reference}",
)
# Make symlink between Resources/share and Contents/MacOS too.
resource_share_dir = os.path.join(self.resources_dir, "share")
if os.path.exists(resource_share_dir):
origin = os.path.join(self.bin_dir, "share")
relative_reference = os.path.relpath(
resource_share_dir, self.bin_dir
)
self.execute(
os.symlink,
(relative_reference, origin, True),
msg=f"linking {origin} -> {relative_reference}",
)
# Make symlink between folders under Resources such as lib and others
# specified by the user in include_files and Contents/MacOS so we can
# use non-relative reference paths to pass codesign...
for filename in os.listdir(self.resources_dir):
target = os.path.join(self.resources_dir, filename)
if os.path.isdir(target):
origin = os.path.join(self.bin_dir, filename)
relative_reference = os.path.relpath(target, self.bin_dir)
self.execute(
os.symlink,
(relative_reference, origin, True),
msg=f"linking {origin} -> {relative_reference}",
)

# Copy the icon
if self.iconfile:
Expand Down

0 comments on commit e9c2e34

Please sign in to comment.