Packaging Binaries

Overview

The bdist_apps command described here packages Python games. A C++ game is packaged by acronmanager dist (see Shipping the game); the section on Signing for macOS and Windows below applies to it as well.

The bdist_apps command will run the build_apps command and then package the resulting builds into archives and installers, one set per platform, in dist/. acronmanager dist runs it (see Building Python Games); by hand:

python setup.py bdist_apps

The bdist_apps command will make use of build_apps.build_base and build_apps.platforms. Its files are named after the game’s name and version, and the platform: asteroids-1.0.0_win_amd64.zip. The following option is unique to bdist_apps (the others are on the List of Build Options page):

installers

A dictionary of installers/packages to create for each platform (keys are strings for the platform, values are lists of installers)

'bdist_apps': {
    'installers': {
        'win_amd64': ['zip', 'nsis'],
        'linux_x86_64': ['gztar'],
    },
},

Without it, a build for Android is packed as an app bundle (aab), one for a manylinux platform as a gztar, and every other one as a zip.

Installers

The list of available installers are:

zip

A zip archive

gztar

A gzip-compressed tar archive

bztar

A bzip2-compressed tar archive

xztar

An xz-compressed tar archive

nsis

An NSIS-based Windows installer (valid only for Windows targets). Requires that makensis is available on the host.

aab

An Android App Bundle, the format Google Play takes (valid only for Android). Requires protobuf beside setuptools. See Building for Android.

The web is not packaged by bdist_apps: the site in build/emscripten_wasm32/ is the result, and acronmanager dist --web zips it (see The Web).

Signing for macOS and Windows

Neither build_apps nor bdist_apps signs a desktop program, and a program that is not signed meets warnings: macOS refuses to open an app downloaded from the internet unless it is signed with a Developer ID and notarised by Apple, and Windows SmartScreen warns about an unsigned executable. (acronmanager dist signs a C++ game’s macOS app bundle ad hoc, which lets it run on the machine that built it, but is not enough for other machines.) Sign the build before you pack it:

  • macOS: sign the app bundle with your Developer ID Application certificate, with the hardened runtime, then notarise it and staple the ticket:

    codesign --force --deep --options runtime --timestamp \
        --sign "Developer ID Application: Your Name (TEAMID)" Asteroids.app
    ditto -c -k --keepParent Asteroids.app Asteroids.zip
    xcrun notarytool submit Asteroids.zip --keychain-profile <profile> --wait
    xcrun stapler staple Asteroids.app
    
  • Windows: sign the .exe (and an NSIS installer) with a code signing certificate, using signtool from the Windows SDK:

    signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 \
        /a asteroids.exe
    

A store that installs the game itself (Steam, itch.io’s app) does not need this, but signing does no harm there either. For Python games, run build_apps, sign the programs in build/<platform>/, and pack them afterwards (bdist_apps with skip_build, or an archive of your own). Android apps are signed as part of their build: see Signing.