Skip to content

Instantly share code, notes, and snippets.

@flyingcakes85
Last active October 18, 2020 13:23
Show Gist options
  • Save flyingcakes85/39697be7dd7f79304f0e5b72a6ac505c to your computer and use it in GitHub Desktop.
Save flyingcakes85/39697be7dd7f79304f0e5b72a6ac505c to your computer and use it in GitHub Desktop.
Distribution independent instructions to package Gamma Text Editor

Packaging Gamma for a distro

This page describes the steps you need to follow when packaging Gamma for a distro. These are distribution-independent instructions and you are also suggested to follow any guidelines laid down by the distro maintainers.

The bundled setup.sh

Gamma is written in python, and all that is required to run it is to clone the repository and execute ./bin/gamma. A setup.sh file is included to let users easily copy icons/desktop files onto their system locations so that they can launch Gamma from their preferred application launcher or desktop environment.

Many users prefer installing applications from their distro repositories as it makes updating/removing application easier.

Steps while packaging

Refer to setup.sh to see the files that need to be copied on to the user's system. Apart from the steps in setup.sh, the following steps need to be followed while packaging. Make sure you follow any other instruction/guideline set by your distro maintainers.

(All the example commands here are executed in the Gamma source code directory. You will probably need to modify the paths depending on your working directory.)

  • Set the package_date variable in gamma.py and home_dir_init.sh to the Unix timestamp while packaging. One way of doing this via the shell is shown below:
package_date=$(date +%s)
sed -i "0,/package_date=0000000000/s//package_date=${package_date}/" home_dir_init.sh
sed -i "0,/package_date = 0000000000/s//package_date = ${package_date}/" gamma.py

(Note that in the second sed command, there are spaces around the equal sign)

  • Create the .desktop file. Assuming that you will install Gamma to /opt/gamma-text-editor, the following commands will do the work.
cp "./bin/io.gitlab.hamadmarri.gamma.desktop.bak" "./bin/io.gitlab.hamadmarri.gamma.desktop"
sed -i -e "s,\[gamma path placeholder\],/opt/gamma-text-editor/bin/gamma," "./bin/io.gitlab.hamadmarri.gamma.desktop"
  • Set packaged in gamma.py to True.
sed -i "0,/packaged = False/s//packaged = True/" "./gamma.py"
  • Create a new folder named home_dir_data in project root and move config.py, signal_handler.py, plugins, style, ui to home_dir_data.
mkdir home_dir_data
mv {config.py,plugins,style,ui,signal_handler.py} ./home_dir_data/

Now go on to create any other required files specified by your distro.

The PKGBUILD at Arch User Repository can be referred to understand the steps. PKGBUILD for gamma-text-editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment