Kitware / trame-cookiecutter

Cookie Cutter template for creating trame application/module
14 stars 7 forks source link

MacOS App Package #9

Closed giiyms closed 1 year ago

giiyms commented 1 year ago

Hello,

How do you create a MacOS version of the app? I see Windows version is using Pyinstaller and mac is using Py2App.

Thanks

jourdain commented 1 year ago

Is that what you are looking for?

cd bundles/desktop/macOS/
pip install -r requirements.txt
python setup.py py2app
giiyms commented 1 year ago

Yep that is what I am trying to use.

I think my setup.py is wrong.

from setuptools import setup

ENTRY_POINT = ["../../../tool/app/main.py"]
DATA_FILES = []

OPTIONS = {
    "argv_emulation": False,
    "strip": True,
    "includes": ["WebKit", "Foundation", "setuptools"],
}

setup(
    app=ENTRY_POINT,
    data_files=DATA_FILES,
    options={"py2app": OPTIONS},
    setup_requires=["py2app"],
)

what is the ENTRY_POINT meant to be?

I get this error when using main.py as the entry point.

/bundles/desktop/macOS/dist/main.app/Contents/Resources/main.py", line 2, in <module>
    from . import engine, ui
jourdain commented 1 year ago

You application should be available within your python environment which means the entrypoint should not be a file path but a module name. (like: my_app.app)

Basically what you need to pass to the entrypoint should be the same thing that go next to the -m when you run your application like python -m xxx.yyy.zzz

Also in general if you want to learn how to use py2app, you should look at their documentation.