google / spatial-media

Specifications and tools for 360º video and spatial audio.
Other
1.86k stars 429 forks source link

Use equivalent of --onefile for the spec file #203

Closed mgorzel closed 6 years ago

mgorzel commented 6 years ago

That creates a single executable file instead of a dir (win) and ~halves the size of the mac executable.

mgorzel commented 6 years ago

Thanks Andrew!

Does this assume that --onefile (and --windowed?) is being used? Is it even possible

Yes, indeed. So now running:

pyinstaller spatial_media_metadata_injector.spec

Should be equivalent to:

pyinstaller --onefile --windowed --clean --name "Spatial Media Metadata Injector" gui.py

Previously, only on Mac a single application bundle was produced.

If so, it'd be nice to either:

Detect (somehow?) inside the spec file that it's been enabled

In the spec file:

--windowed sets console=False. Also, on a Mac it adds:

app = BUNDLE(coll,
             name='Spatial Media Metadata Injector.app',
             icon=None,
             bundle_identifier=None)

Which results in a single app bundle.

--onefile removes COLLECT and moves the binaries, datas and zipfiles to the EXE. That results in a single exe on Win and Mac (inside the app bundle).

AFAIK, --clean is used already if the pyinstaller builds from a spec file.

At a minimum, include some documentation in the file and/or in the README.md

Building a standalone GUI application from README.md instructions should now result in similar binaries as used in the Release (e.g. singe executables), so not sure if updates to the README.md should be necessary? 'In the file', do you mean we could document which parts correspond to the effect of the flags --windowed and --onefile?

Cheers,

Marcin

ascherkus commented 6 years ago

Thanks for the explanation - that clears up everything. Indeed no README.md changes necessary!

Boscop commented 4 years ago

If anyone here is wondering how to turn the CLI into an exe, I did it like this:

pip install pyinstaller==3.6
pyinstaller --onefile --name spatialmedia spatialmedia\__main__.py

Which produced dist\spatialmedia.exe.

It also works with Angelo Farina's fork which supports higher order ambisonics: http://www.angelofarina.it/Public/Jump-Videos/spatial-media-2.1-HOA.zip


Btw, is this spatial-media python package compatible with Python 3? The latest pyinstaller only supports Python 3.