libmapper / webmapper

An HTML5-based graphical interface to libmapper.
http://www.libmapper.org
GNU Lesser General Public License v2.1
17 stars 15 forks source link

py2app packaging #10

Open johnty opened 5 years ago

johnty commented 5 years ago

I've been experimenting with the packaging process, and have ran into the following:

the basic process to bundle the package is to just run the following after py2app is installed:

python setup.py py2app

also note that currently setup.py doesn't include the html folder in data_files, so that needs to be added to the list for the base html file to be included in the package it seems.

radarsat1 commented 5 years ago

On dimple I have been experimenting with using Travis to package builds. It works well, you can generate a "build artifact" and then post it to the "gh-pages" branch which makes it show up on github.io. That way it would be done in a clean environment automatically with all reproducibility instructions in one place.

johnty commented 5 years ago

Thanks Steve! I think getting it on Travis would be great as a way to automate the builds on a clean system.

In the mean time, I've figured out that we can explicitly pass the following argument to py2app:

python setup.py py2app --frameworks /opt/local/lib/libffi.6.dylib

This is somewhat strange still, since on systems where it initially fails, libffi is usually present but for some reason the embedded python runtime from the built pacakge is not looking there. I expect there's a bad configuration in my setup somewhere... On systems where the package doesn't run, I can simply copy over the local version of libffi alongside the embedded dylibs, and everything will work fine. For now the above explicit inclusion works, except I also found that in my particular case a system before High Sierra (10.12) does not like that version of libffi...

ChristianFrisson commented 4 years ago

Hi libmapper/webmapper team,

On Ubuntu / Pop!_OS 20.04, pip3 install py2app then python3 setup.py py2app fails with:

copying file build/bdist.linux-x86_64/python3.8-standalone/app/python38.zip -> dist/WebMapper.app/Contents/Resources/lib
Traceback (most recent call last):
  File "setup.py", line 17, in <module>
    setup(name='WebMapper',
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 907, in run
    self._run()
  File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 1125, in _run
    self.run_normal()
  File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 1238, in run_normal
    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
  File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 1545, in create_binaries
    dst = self.build_executable(
  File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 2315, in build_executable
    self.copy_file(zlib.__file__, os.path.dirname(arcdir))
AttributeError: module 'zlib' has no attribute '__file__'

From the first line I assume packaging has been developed for macOS only?

Kind regards, Christian

radarsat1 commented 4 years ago

It's been a while, but I thought the Windows equivalent of py2app was py2exe. Probably things have changed.

ChristianFrisson commented 4 years ago

Answer from the py2app website: py2app - Create standalone Mac OS X applications with Python.

Maybe the libmapper README could state "To build standalone application on macOS"?

malloch commented 4 years ago

Hi Christian,

Thanks for the feedback – I updated the documentation with the changes you suggested.

Cheers, Joe

On May 26, 2020, at 7:00 PM, Christian Frisson notifications@github.com wrote:

Answer to self: py2app - Create standalone Mac OS X applications with Python https://py2app.readthedocs.io/.

Maybe the libmapper README could state "To build standalone application on macOS"?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/libmapper/webmapper/issues/10#issuecomment-634303405, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7CDEOOHSVK4DD7B7GFLDRTQ3ZFANCNFSM4GXZQZRA.