The Distribution Utilities (distutils)
Python modules, extensions, and applications can be packaged and distributed in several forms:
- Compressed archive files
Generally .zip for Windows and .tar.gz (a.k.a. .tgz) for Unix-based systems, but both forms are portable
- Self-unpacking or self-installing executables
Normally .exe for Windows
- Self-contained, ready-to-run executables that require no installation
For example, .exe for Windows, ZIP archives with a short script prefix on Unix, .app for the Mac, and so on
- Platform-specific installers
For example, .msi on Windows, .rpm and .srpm on most Linux distributions, and .deb on Debian GNU/Linux and Ubuntu
- Python Eggs
A very popular third-party extension, covered in Python Eggs
When you distribute a package as a self-installing executable or platform-specific installer, a user can then install the package simply by running the installer. How to run such an installer program depends on the platform, but it no longer matters which language the program was written in. How to build self-contained, ready-to run executables for various platforms is covered in Chapter 27.
When you distribute a package as an archive file or as an executable that unpacks but does not install itself, it does matter that the package was coded in Python. In this case, the user must first unpack the archive file into some appropriate directory, say C:\Temp\MyPack on a Windows machine or ~/MyPack on a Unix-like machine. Among the extracted files there should be a script, conventionally ...
Get Python in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.