takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
896 stars 119 forks source link

Nest installers #155

Closed JoshMayberry closed 6 years ago

JoshMayberry commented 6 years ago

Added code for running prerequisite installers for your installer. For example, say you needed to have specific drivers installed for your program to work correctly. It would be nice if the installer for your program checked to see if those drivers were installed, and if they were not- run the installer to install them.

In the example below, I have a file called Datalogic_USBCOMInstaller.msi, which will install the drivers for a barcode scanner. I pass in the following to nsist.InstallerBuilder as the parameter extra_installers: 'extra_installers': [('Datalogic_USBCOMInstaller.msi', '', 0, {'not_inRegistry': ('HKLM', 'DRIVERS\\DriverDatabase\\DriverInfFiles\\oem187.inf', 'Active', '')})]

This will add code to the generated .nsi file which will run the installer Datalogic_USBCOMInstaller.msi and wait for it to finish, only if the key DRIVERS\\DriverDatabase\\DriverInfFiles\\oem187.inf with the sub-key Active is not in the HKLM registry.

Multiple conditions can be added by adding keys to the dictionary that is passed in as the 4th element in the tuple. Other installers can be added as more 4-item tuples in the list.

Right now, I have code for:

The conditions that I have created are:

Conditions that I laid the groundwork for, but need more work on the NSIS function that accompanies them:

takluyver commented 6 years ago

Thanks for opening a PR; I can see that you've put in a lot of work on this, and I appreciate that you're interested enough in Pynsist to work on it and contribute to it. However, I'm going to decline this feature: it's a lot of added complexity that I don't want to try to support.

I've written a page in the docs that explains why I often decline features for Pynsist, and what you can do instead if you need more flexibility: https://pynsist.readthedocs.io/en/latest/design.html

JoshMayberry commented 6 years ago

Makes sense. Thank you for taking the time to look at it.