InstallerBuilder(appname, version, shortcuts, *, publisher=None, icon='/home/docs/checkouts/readthedocs.org/user_builds/pynsist/checkouts/2.1/nsist/glossyorb.ico', packages=None, extra_files=None, py_version='3.6.3', py_bitness=32, py_format='bundled', inc_msvcrt=True, build_dir='build/nsis', installer_name=None, nsi_template=None, exclude=None, pypi_wheel_reqs=None, extra_wheel_sources=None, commands=None, license_file=None)¶
Controls building an installer. This includes three main steps:
- Arranging the necessary files in the build directory.
- Filling out the template NSI file to control NSIS.
makensisto build the installer.
- appname (str) – Application name
- version (str) – Application version
- shortcuts (dict) – Dictionary keyed by shortcut name, containing dictionaries whose keys match the fields of Shortcut sections in the config file
- publisher (str) – Publisher name
- icon (str) – Path to an icon for the application
- packages (list) – List of strings for importable packages to include
- commands (dict) – Dictionary keyed by command name, containing dicts defining the commands, as in the config file.
- pypi_wheel_reqs (list) – Package specifications to fetch from PyPI as wheels
- extra_wheel_sources (list of Path objects) – Directory paths to find wheels in.
- extra_files (list) – List of 2-tuples (file, destination) of files to include
- exclude (list) – Paths of files to exclude that would otherwise be included
- py_version (str) – Full version of Python to bundle
- py_bitness (int) – Bitness of bundled Python (32 or 64)
- py_format (str) – (deprecated) ‘bundled’. Use Pynsist 1.x for ‘installer’ option.
- inc_msvcrt (bool) – True to include the Microsoft C runtime with ‘bundled’ Python.
- build_dir (str) – Directory to run the build in
- installer_name (str) – Filename of the installer to produce
- nsi_template (str) – Path to a template NSI file to use
Run all the steps to build an installer.
Fetch the embeddable Windows build for the specified Python version
It will be unpacked into the build directory.
In addition, any
*._pthfiles found therein will have the pkgs path appended to them.
write_script(entrypt, target, extra_preamble='')¶
Write a launcher script from a ‘module:function’ entry point
py_version and py_bitness are used to write an appropriate shebang line for the PEP 397 Windows launcher.
Prepare shortcut files in the build directory.
If entry_point is specified, write the script. If script is specified, copy to the build directory. Prepare target and parameters for these shortcuts.
Also copies shortcut icons.
Move requested packages into the build directory.
If a pynsist_pkgs directory exists, it is copied into the build directory as pkgs/ . Any packages not already there are found on sys.path and copied in.
Copy a list of files into the build directory, and add them to install_files or install_dirs as appropriate.
Write the NSI file to define the NSIS installer.
Most of the details of this are in the template and the
Runs makensis using the specified .nsi file
Returns the exit code.