Gaphor on Linux
To set up a development environment with Linux, you first need a fairly new Linux distribution version. For example, the latest Ubuntu LTS or newer, Arch, Debian Testing, SUSE Tumbleweed, or similar. Gaphor depends on newer versions of GTK, and we don’t test for backwards compatibility. You will also need the latest stable version of Python. In order to get the latest stable version without interfering with your system-wide Python version, we recommend that you install pyenv.
Install the pyenv prerequisites first, and then install pyenv:
$ curl https://pyenv.run | bash
Make sure you follow the instruction at the end of the installation script to install the commands in your shell’s rc file. Next install the latest version of Python by executing:
$ pyenv install 3.x.x
Where 3.x.x is replaced by the latest stable version of Python (pyenv should let you tab-complete available versions).
Next install the Gaphor prerequisites by installing the gobject introspection and cairo build dependencies, for example, in Ubuntu execute:
$ sudo apt-get install -y python3-dev python3-gi python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev libgtksourceview-4-dev
Install Poetry (you may want to consider alternative methods):
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
$ cd gaphor # activate latest python for this project $ pyenv local 3.x.x # 3.x.x is the version you installed earlier $ poetry env use 3.x # ensures poetry /consistently/ uses latest major release $ poetry config virtualenvs.in-project true $ poetry install $ poetry run gaphor
Create a Flatpak Package
The main method that Gaphor is packaged for Linux is with a Flatpak package. Flatpak is a software utility for software deployment and package management for Linux. It offer a sandbox environment in which users can run application software in isolation from the rest of the system.
$ sudo apt-get install flatpak-builder
Install the GNOME SDK
$ flatpak install flathub org.gnome.Sdk 3.38
Clone the Flathub repository and install the necessary SDK:
git clone https://github.com/flathub/org.gaphor.Gaphor.git $ cd org.gaphor.Gaphor $ make setup
Build Gaphor Flatpak
Install the Flatpak
$ make install
Create an AppImage Package
AppImage is a format for distributing portable software on Linux without needing superuser permissions to install the application. The AppImage file is one executable which contains both Gaphor and Python. It allows Gaphor to be run on any AppImage supported Linux distribution without installation or root access.
We build our AppImage by first bundling Gaphor with PyInstaller and then converting it in to an AppImage.
Activate your virtualenv,
make update VERSION=x.x.x
Build the AppImage by running
Test that Gaphor-x86_64.AppImage works by running