py2app setup.py usage question

2019-03-31 18:30发布

Ok so I'm trying to use py2app to generate a distribution for my project. I'm still not sure I get the hang of it tho. So my setup.py looks like this:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup
import setuptools

PACKAGES = ['sqlalchemy.dialects.sqlite']
MODULES = ['sqlite3']

APP = ['tvb/interfaces/web/run.py']
OPTIONS = {'argv_emulation': True,
           'packages': PACKAGES ,
           'includes' : MODULES }
DATA_FILES = []

setup(
    app=APP,
    data_files=DATA_FILES,
    packages = setuptools.find_packages(), 
    include_package_data=True,
    options={'py2app': OPTIONS},
    setup_requires=['py2app', "pyopengl", "cherrypy", "sqlalchemy", "simplejson", 
                          "formencode", "genshi", "quantities","numpy", "scipy",
                          "numexpr", "nibabel", "cfflib", "mdp", "apscheduler",
                          "scikits.learn"]
)

So my first question would be: What should I include in my MODULES for py2app here? Does py2app know to scan for the things in setup_requires and include them or do I need to add some entries for them in MODULES ?

Another problem is that I'm getting an: sqlalchemy.exc.ArgumentError: Could not determine dialect for 'sqlite' when trying to run my app. After lots of googling I only saw that for py2exe you need to include the sqlalchemy.dialects.sqlite as a package but it doesn't seem to work for me. Am I missing something here?

The last one is that I'm getting a: malformed object (load command 3 cmdsize not a multiple of 8) just before the python setup.py py2app. Is this normal?

Regards, Bogdan

标签: python py2app
1条回答
Evening l夕情丶
2楼-- · 2019-03-31 19:17

Well seems I got the whole thing wrong.

'includes' : ['sqlalchemy.dialects.sqlite']

Instead of packages, and that seems to have done the trick.

查看更多
登录 后发表回答