Skip to content

Commit

Permalink
Add support to macdist for "include_resources" to include directories…
Browse files Browse the repository at this point in the history
… or files in the Resources directory of the generated app bundle. (#423)
  • Loading branch information
Dan McCombs authored and anthony-tuininga committed Sep 29, 2018
1 parent b18b4c3 commit f204291
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cx_Freeze/macdist.py
Expand Up @@ -81,6 +81,10 @@ class bdist_mac(Command):
'the app bundle. A basic one will be generated by default.'),
('include-frameworks=', None, 'A comma separated list of Framework '
'directories to include in the app bundle.'),
('include-resources=', None, 'A list of tuples of additional ' \
'files to include in the app bundle\'s resources directory, with ' \
'the first element being the source, and second the destination ' \
'file or directory name.'),
('codesign-identity=', None, 'The identity of the key to be used to '
'sign the app bundle.'),
('codesign-entitlements=', None, 'The path to an entitlements file '
Expand All @@ -98,6 +102,7 @@ def initialize_options(self):
self.bundle_name = self.distribution.get_fullname()
self.custom_info_plist = None
self.include_frameworks = []
self.include_resources = []
self.codesign_identity = None
self.codesign_entitlements = None
self.codesign_deep = None
Expand Down Expand Up @@ -274,6 +279,15 @@ def run(self):
self.copy_tree(framework, self.frameworksDir + '/' +
os.path.basename(framework))

# Copy in Resources
for resource, destination in self.include_resources:
if os.path.isdir(resource):
self.copy_tree(resource, self.resourcesDir + '/' +
destination)
else:
self.copy_file(resource, self.resourcesDir + '/' +
destination)

# Create the Info.plist file
self.execute(self.create_plist, ())

Expand Down
8 changes: 8 additions & 0 deletions doc/distutils.rst
Expand Up @@ -283,6 +283,11 @@ bundle (a .app directory).
| include_frameworks | A list of Framework directories to include in |
| | the app bundle. |
+--------------------------+--------------------------------------------------+
| include_resources | A list of tuples of additional files to include |
| | in the app bundle's resources directory, with the|
| | first element being the source, and second the |
| | destination file or directory name. |
+--------------------------+--------------------------------------------------+
| codesign_identity | The identity of the key to be used to sign the |
| | app bundle. |
+--------------------------+--------------------------------------------------+
Expand Down Expand Up @@ -311,6 +316,9 @@ bundle (a .app directory).
.. versionchanged:: 4.3.4
Added the ``codesign_deep`` and ``codesign_resource_rules`` options.

.. versionchanged:: 5.1.2
Added the ``include_resources`` option.

bdist_dmg
`````````

Expand Down

0 comments on commit f204291

Please sign in to comment.