Skip to content

Bundling qbank

cjshawMIT edited this page May 1, 2017 · 9 revisions

Scenarios for bundling

If you need a standalone qbank executable (for running with unplatform, for example), then you can use pyinstaller to create a bundle. This should work with OS X, Windows, or Linux, whatever pyinstaller supports. Note that to create a bundle for a platform, you need to run pyinstaller on that specific platform. You cannot build Windows bundles on OS X.

The bundled package will run on port 8080 unless you manually change main.py and insert the port before bundling, like:

if (not is_test()) and __name__ == "__main__":
    sys.argv.append('9123')
    app.run()

This is because pyinstaller does not allow you to include command line arguments as part of the bundling process.

Pyinstaller

There are many hidden imports in qbank that need to be declared for pyinstaller to include them. The best way to create the bundle is using the included spec file.

pyinstaller main.spec

Updating for unplatform

Once qbank is bundled for unplatform, it needs to get included in the unplatform bundle. This is done by adding the qbank executable to the qbank bundles repository.

  1. Clone / pull that repository.
  2. Add a directory with the qbank version.
  3. Copy in the qbank executable to the new directory, renaming the file to qbank-lite-v#.#.#-32bit-ssl.exe.
  4. Commit and push those changes to master.
  5. Checkout release branch.
  6. Copy the qbank executable into the release/ directory, renaming the file to qbank-lite-v#.#.#-32bit-ssl.exe.
  7. Remove the old exe file.
  8. Commit and push those changes to release.

For example:

$ git pull
$ mkdir v3.14.4
$ cp ~/projects/qbank-lite/dist/main.exe v3.14.4/qbank-lite-v3.14.4-32bit-ssl.exe
$ git add .
$ git commit -m 'with qbank 3.14.4 bundle for windows'
$ git push
$ git checkout release
$ cp ~/projects/qbank-lite/dist/main.exe release/qbank-lite-v3.14.4-32bit-ssl.exe
$ git rm release/qbank-lite-v3.7.7-32bit-ssl.exe
$ git add .
$ git commit -m 'update released windows version'
$ git push