py2app - 保留目录结构

时间:2012-12-09 05:46:16

标签: python-2.7 py2app

我想制作一个mac os x app来分发我的程序。

问题是当前脚本将“images / Diagram.png”和“images”文件夹下的其他文件放到“Resources”中,而不是按照预期放入“Resources / images”

为了将png文件放在图像下,我可以在此setup.py部分中更改哪些内容?

mainscript, ico, icns = "aproxim.py", "sum.ico", "sum.icns"

files = ["images/Diagram.png", "images/document.png", "images/Exit.png", "images/floppydisc.png",
         "images/folder.png", "images/Info.png", "images/settings.png"]
scripts = ["app_settings_dialog", "app_window", "approximator", "approximator2", "data_format",
           "easy_excel", "functions", "main_window", "settings_dialog",
           "util_data", "util_parameters"]

description = "Approximator is program for experimental data approximation and interpolation (20 dependencies for select)"

common_options = dict(name = "Approximator", version = "1.7", description = description)

if sys.platform == 'darwin':
    setup(
        setup_requires = ['py2app'],
        app = [mainscript],
        options = dict(py2app = dict(includes = scripts, resources = files, iconfile = icns)),
        **common_options)

1 个答案:

答案 0 :(得分:1)

这很容易,希望它对其他Python开发人员有用:

resources = [('images', files), ('', [ico])]