Nullsoft Scriptable Installer Service is a tool you can use to generate installers. It’s farily popular - you’ve probably used an installer generated by it - the
one I can think of first would be WinAmp, but I don’t think anyone has installed WinAmp since 2003, so it’s not a good example.
I downloaded the NSIS installer from SourceForge. I downloaded the most recent version which is 3.03.
My goal here is to create a graphical installer which will encapsulate all of the files which are part of a Py2Exe-generated Python Executable and install them to a folder in the root of the C: drive on a PC.
Installation Steps
Double click the installer to start it.
On the first screen, click ‘Next’:
Click ‘I agree’ on the next screen:
The ‘Full’ install is the default and is acceptable. Click ‘Next’:
The default installation path is acceptable. Click ‘Install’:
The installation will proceed:
When finished you will be presented with a new screen. I de-selected viewing the release notes and left starting NSIS selected, then clicked ‘Finish’:
Creating an Installer
This is the screen presented to you when you start NSIS.:
Turns out that the basis of an NSIS installer is a script. Just a plan ol’ text file.
A good one is this:
This script assumes a Python script turned into an executable with the output files bing in ./dist.
Creating a Directory
Most of my Python apps use a ‘logs’ directory to store logs, but I wouldn’t want the installer to package up my logs directory from a working directory structure - that would add all of my log files to the installer. No bueno.
Instead, I need the NSIS script to create the logs directory in the appropriate place.
NSIS can do that, here’s the documentation of CreateDirectory.
Here’s a modified ‘install’ section with the directive to create the log subdirectory: