Package Manuskript for Linux with PyInstaller - olivierkes/manuskript GitHub Wiki

SUMMARY

This guide describes the steps for packaging Manuskript for Linux. The resulting package runs on x86-64 bit Linux computers only.

CONSIDERATIONS

Before embarking on this procedure consider creating a clean 64-bit Virtual Machine for the purpose of creating Manuskript PyInstaller packages. The reasons are three-fold:

Users with 32-bit Linux will need to run Manuskript from source code. See Run Manuskript from Source Code on Linux.

Note: I chose to create a Debian 8 Jessie 64-bit VM in order to support manuskript on a large number of currently supported GNU/Linux distros. At time of writing, Debian Jessie was the current oldStable release. More information on why Debian 8 was chosen can be found in the following comment.

INSTALLATION

Install Manuskript

A working version of Manuskipt is required. If creating an official release, then download and extract an official source code release zip or tarball file.

unzip manuskript-#.#.#.zip

Be sure to include optional software such as Markdown and PyEnchant so that these are included in the package.

sudo apt install python3-markdown python3-pyenchant

See Run Manuskript from Source Code on Linux.

Note that pyenchant is only listed as being supported with PyInstaller on Windows. See PyInstaller - Supported Packages and search for pyenchant. The results on Linux may be unpredictable. For example I have seen a PyInstall packager with pyenchant work on one distro, but cause a segmentation fault on another.

Install Prerequisite Software Packages

Install all the necessary software required for creating the manuskript package.

  1. Install zip

    sudo apt install zip
    
  2. Install pip and PyInstaller

    sudo apt install python3-pip
    sudo pip3 install pyinstaller
    

PACKAGE CREATION

Create a zip file package that can be installed and run on x86-64 computers.

  1. Create the Manuskript package.

    cd manuskript
    python3 /usr/local/bin/pyinstaller manuskript.spec
    

    This should create a self-contained directory called dist under the current working directory.

  2. Change into the dist directory.

    cd dist
    
  3. Remove manuskript/libdrm.so.2 file to avoid import errors on various graphics cards.

    rm manuskript/libdrm.so.2
    

    For examples of ImportError see Issue 82, Issue 115, and Issue 179.

  4. Create a zip file for specifically for Ubuntu 14.04 using the manuskript files under the dist directory.

    zip -r manuskript-#.#.#{-#}-ubuntu1404-linux64.zip ./manuskript
    

    Note that I tried removing manuskript/libstdc++.so.6 but then the package failed to run on Xubuntu 14.04 LTS. Instead it complained with an "ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version 'CXXABI_1.3.8' not found (required by /home/user/manuskript/libQt5Core.so.5)". Hence we build this Ubuntu 14.04 specific package with manuskript/libstdc++.so.6 included.

  5. Remove /manuskript/libstdc++.so.6 file to avoid problems running on other distros like Fedora 25.

    rm /manuskript/libdrm.so.2
    

    For mention of this issue see Appendix A: Linux Distro Test Results near bottom of SourceForge Manuskript 0.5.0 release.

  6. Create a zip file using the manuskript files under the dist directory.

    zip -r manuskript-#.#.#{-#}-linux64.zip ./manuskript
    

    Note that the -# within the curly braces is optional. It is used to indicate updated packages of the same manuskript #-#-# version. The curly braces are not included in the file name.

    For example:

    First packaging of manuskript v0.4.0 would be named:

    manuskript-0.4.0-linux64.zip
    

    Or:

    manuskript-0.4.0-1-linux64.zip
    

    Second repackaging of manuskript v0.4.0 would be named:

    manuskript-0.4.0-2-linux64.zip
    

    And so on until the version of manuskript changed.

PACKAGE TEST INSTALLATION

Use the following steps on a different computer or Virtual Machine to test that the manuskript package works.

  1. Copy the manuksript-#.#.#{-#}-linux64.zip file and extract.

    unzip manuskript-#.#.#{-#}-linux64.zip
    
  2. Install a different language dictionary (e.g. French).

    sudo apt install aspell-fr
    
  3. Install pandoc for more export format options.

    sudo apt install pandoc
    
  4. Run manuskript and open/create a project.

    ./manuskript/manuskript
    # Open/create a project
    
  5. Check for extra language dictionaries (e.g., French).

    # Check *Tools -> Dictionary* for French "fr" dictionaries.
    
  6. Check for additional pandoc export options.

    # Select *File -> Compile*
    # Check *Export to:* drop down for pandoc export options.
    
  7. Exit manuskript.

REFERENCES