简体   繁体   English

Esky不包括子模块

[英]Esky not including sub-module

I have a medium-size PyQT5 desktop application that has been working fine with py2app. 我有一个中等大小的PyQT5桌面应用程序,可以与py2app正常工作。 I want to incorporate Esky so that the app can update itself, but the app terminates during startup (before displaying the main window) with a log entry that says "HelloApp Error" (where "HelloApp" is the name of my application). 我想合并Esky,以便该应用程序可以自我更新,但是该应用程序在启动过程中(显示主窗口之前)会终止,并显示一条日志条目“ HelloApp Error”(其中“ HelloApp”是我的应用程序的名称)。

I've created a small test case that reproduces the problem that is available at https://github.com/markmont/esky-package-question 我创建了一个小的测试案例,该案例重现了https://github.com/markmont/esky-package-question上存在的问题

The test-case app has the following structure: 测试用例应用程序具有以下结构:

HelloApp/
    HelloApp/
        HelloApp.py
        helloform
            __init__.py
    setup.py

setup.py contains: setup.py包含:

from esky import bdist_esky
from distutils.core import setup

PY2APP_OPTIONS = {
    'argv_emulation': True,
    'includes': [ 'sip', 'PyQt5', 'helloform' ],
    'qt_plugins': [ '*' ]
    }
ESKY_OPTIONS = {
    "freezer_module": "py2app",
    "freezer_options": PY2APP_OPTIONS,
    "includes": [ 'sip', 'PyQt5', 'helloform' ]
    }
HelloApp = bdist_esky.Executable( "HelloApp/HelloApp.py", gui_only=True )

setup(
    name='HelloApp',
    version = "2014060301",
    data_files=[],
    options = { "bdist_esky": ESKY_OPTIONS },
    scripts=[ HelloApp ]
)

HelloApp.py contains the statement from helloform import Form -- this appears to be what is causing the app to fail to start with the error "HelloApp Error", as if I remove that statement and paste in the contents of helloform/ init .py the application starts up and works properly. HelloApp.py包含from helloform import Form的语句-这似乎是导致应用程序无法启动的错误“ HelloApp Error”的原因,就像我删除了该语句并粘贴了helloform / init .py的内容一样。该应用程序将启动并正常运行。

Also, if I move everything into a single directory and adjust the paths in setup.py, then the problem does not occur -- Esky finds helloform.py (formerly named helloform/ init .py), includes it, and the application starts up and works properly: 另外,如果我将所有内容移动到单个目录中并调整setup.py中的路径,则不会发生问题-Esky找到helloform.py(以前称为helloform / init .py),将其包含在内,然后应用程序启动并正常工作:

HelloApp/
    HelloApp.py
    helloform.py  # formerly ./HelloApp/helloform/__init__.py
    setup.py

...but putting everything in single directory is not a scalable solution for a medium-to-large application. ...但是对于大中型应用程序,将所有内容都放在一个目录中并不是一个可扩展的解决方案。

There are no error messages in the output of python setup.py bdist_esky when the problem occurs, and I have not found the answer in the Esky documentation or in various examples on the web. 发生问题时, python setup.py bdist_esky的输出中没有错误消息,并且在Esky文档或网络上的各种示例中都找不到答案。

The full error from /var/log/system.log is: /var/log/system.log中的完整错误是:

2014-06-03 13:03:07.100 HelloApp[14968]: HelloApp Error

I'm assuming that I'm not using Esky's includes option properly in setup.py, but I've got no clue as to how to fix this -- can anyone help? 我假设我没有在setup.py中正确使用Esky的includes选项,但是我不知道如何解决它-有人可以帮忙吗?

Other possibly relevant details: MacOS X 10.9 Mavericks, Python 2.7.6 (local build), qt-5.3.0 opensource, sip 4.16, PyQT 5.3.0 (GPL), py2app 0.8.1 patched to support PyQT5 , and the latest version of Esky from GitHub. 其他可能相关的详细信息:MacOS X 10.9 Mavericks,Python 2.7.6(本地版本),qt-5.3.0开源,sip 4.16,PyQT 5.3.0(GPL), 为支持PyQT5修补的 py2app 0.8.1和最新版本来自GitHub的Esky。

Thanks in advance! 提前致谢!

I've solved this problem -- the problem was due to my limited knowledge of Python distutils and setuptools. 我已经解决了这个问题-该问题是由于我对Python distutils和setuptools的了解有限。 Since things "just worked" with py2app (which was using setuptools), I assumed that the problem was with how Etsy was configured when the problem was really with how I was using distutils. 由于使用py2app(使用setuptools)可以“正常工作”,所以我认为问题出在我实际使用distutils的时候是如何配置Etsy的。

The problem was that helloworld.py was not being copied into the frozen app. 问题在于helloworld.py没有被复制到冻结的应用程序中。

The solution involved restructuring the files and changing the disutils configuration to explicitly add HelloApp as a package. 该解决方案涉及重组文件并更改disutils配置,以将HelloApp作为软件包显式添加。

New file structure: 新文件结构:

HelloApp/
    hello.py   # formerly HelloApp.py
    HelloApp/
        __init__.py
        helloform.py
    setup.py

New setup.cfg: 新的setup.cfg:

from esky import bdist_esky
from distutils.core import setup

PY2APP_OPTIONS = {
    'argv_emulation': True,
    'includes': [ 'sip', 'PyQt5' ],
    'qt_plugins': [ '*' ]
    }
ESKY_OPTIONS = {
    "freezer_module": "py2app",
    "freezer_options": PY2APP_OPTIONS,
    "includes": [ 'sip', 'PyQt5' ]
    }

HelloApp = bdist_esky.Executable( "hello.py", gui_only=True )

setup(
    name='hello',
    version = "2014060301",
    data_files=[],
    options = { "bdist_esky": ESKY_OPTIONS },
    scripts=[ HelloApp ],
    packages=[ 'HelloApp' ],
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM