Skip to content
Andrew J. Gillis edited this page May 27, 2018 · 2 revisions

How pymakeself Works

Here is how pymakeself creates its self-extracting archive:

Create an executable (self-extracting) installer Python script.

The installer contains a copy of the contents of a specified directory, and it contains the specified install script. When the installer is run, it extracts itself and runs the install script.

The installer is created by first creating a directory, package_name, that contains a subdirectory called install_files. The install_files subdirectory contains a copy of the contents of the specified content_dir. If a setup_script is specified, then that setup_script is also copied into the package_name dir, along with installtools if those are requested.

    somewhere/
        content_dir/ }---------+
                               |
    someplace/                 |
        setupscript.py }-----+ |
                             | | <copy>
    working_tmp_dir/         | |
        package_name/        | |
            setupscript.py <-+ |
            installtools/      |
            install_files/ <---+
                file1
                file2
                ...

The package_name directory is then archived into a tar file:

    working_tmp_dir/
        +--------------------+
        | package_name/      |
        |     setupscript.py |
        |     installtools/  |
        |     install_files/ |}-----+
        |         file1      |      |
        |         file2      |      |
        |         ...        |      | <archive>
        +--------------------+      | [optionally encrypt]
                                    |
        package_name.tar.gz <-------+

Then the tar file is written into the data portion of a Python install script:

    working_tmp_dir/
        +---------------------+
        | package_name.tar.gz |}----+
        +---------------------+     | <embed>
                                    |
    ~/package_name.py <-------------+

This install script can be run on another machine to extract the archive and run the setup_script script inside it.

Clone this wiki locally