Search code examples
pythonpython-packagingpynsist

Bundling application and dependencies with pynsist


I'm a python newbie so please bear with me.

I'm trying to bundle a PyQt4 application with pynsist. I want to import module A which depends on module B, C, and D, but specifying module A in the installer.cfg file does not bundle B, C, and D. Do I need to specify ALL the modules my application depends on in the installer.cfg file, and if so is there a good method of finding out what they are?


Solution

  • You need to specify all of the modules or packages to be bundled.

    If these are modules you are writing yourself, you can put them all in one package, so you import them as import mypkg.A or import mypkg.B. Then you can ask it to bundle mypkg as a whole.

    You can see what modules your program has loaded by putting this code at the end:

    import sys
    print(sorted(sys.modules))
    

    That will show you every module that it's loaded, including standard library modules (which are always bundled).