Install any Python 3 package by renaming an exe! WTF? Yes, really.
The repo contains an EXE file called "install_1NSERT-PYPI-PKG-HERE.exe". Replace '1NSERT-PYPI-PKG-HERE' with your Pypi package name. The installer will automatically download Python 3 (if it needs to), install your app, and make a start menu link to run it. Sha256 integrity checks are now built in to the installer. So binary files downloaded by the installer are checked and won't be run if their hashes don't match. I have further documented the source of every binary file in a file called 'file_meta.txt'.
The entry point is python.exe -m your-package /polyinstall.
Add this to your package's main.py file. E.g:
if sys.argv[-1] == "/polyinstall":
# Custom run code here.
print("Hello, world!")
You can use a resource editor to change the installer icon for the EXE file. This is what will show up as the icon for your program when it's installed.
The base URL for the installer is part of the EXE's file description field. Modifying this allows for the EXE to be patched with different package mirrors. Note: the installer now includes SHA256 integrity checking. To see the binary files that may be installed see file_meta.txt.
Nullsoft, Inc, the company that created the goated and much loved Winamp also wrote another program that is incredibly under-rated. It's an installer system for Windows that offers support for Windows 95 to Windows 11 (including server versions.) I wrote a simple downloader for Python and make the installer itself the input system. This means that you can create a portable, single EXE for any Python package by renaming a file.
You don't need to do this to use the installer. But for development:
- Install NSIS.
- In this repo go to nsis.
- Copy the plugins to the right program files x86/nsis folder.
- Open NSIS and go to compile a script.
- Select installer.nsi.
Make sure that if you clone the repo your OS hasn't 'blocked' the DLL files for the plugins. Otherwise you won't be able to build the installer.