Remove venv file and update documentation

This commit is contained in:
Arjan Molenaar 2021-02-18 09:08:57 +01:00
parent a21c8f6532
commit 6e24bd4148
No known key found for this signature in database
GPG Key ID: BF977B918996CB13
4 changed files with 18 additions and 117 deletions

View File

@ -28,12 +28,17 @@ $ sudo apt-get install -y python3-dev python3-gi python3-gi-cairo
gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
```
Install Poetry (you may want to consider installing poetry via [pipx](https://pypi.org/project/pipx/), instead of pip):
```bash
pip install --user poetry
```
[Clone the
repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository).
```bash
$ cd gaphor
$ source venv
$ poetry install
$ poetry run gaphor
```
@ -83,7 +88,7 @@ installation or root access.
We build our AppImage by first bundling Gaphor with PyInstaller and then
converting it in to an AppImage.
1. Activate your virtualenv, `source venv`
1. Activate your virtualenv, `poetry shell`
1. `cd appimage`

View File

@ -8,11 +8,15 @@ To setup a development environment with macOS:
```bash
$ brew install python3 gobject-introspection gtk+3 adwaita-icon-theme gtk-mac-integration
```
Install Poetry (you may want to consider installing poetry via [pipx](https://pypi.org/project/pipx/), instead of pip):
```bash
pip install --user poetry
```
[Clone the
repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository).
```
$ cd gaphor
$ source ./venv
$ poetry install
$ poetry run gaphor
```

View File

@ -5,7 +5,7 @@
To setup a development environment in Windows:
1) Go to http://www.msys2.org/ and download the x86_64 installer
1) Follow the instructions on the page for setting up the basic environment
1) Run ``C:\msys64\mingw64.exe`` - a terminal window should pop up
1) Run `C:\msys64\mingw64.exe` - a terminal window should pop up
```bash
$ pacman -Suy
$ pacman -S git mingw-w64-x86_64-gcc mingw-w64-x86_64-gtk3 \
@ -14,12 +14,15 @@ mingw-w64-x86_64-gobject-introspection mingw-w64-x86_64-python \
mingw-w64-x86_64-python-gobject mingw-w64-x86_64-python-cairo \
mingw-w64-x86_64-python-pip
```
Install Poetry (you may want to consider installing poetry via [pipx](https://pypi.org/project/pipx/), instead of pip):
```bash
pip install --user poetry
```
[Clone the
repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository).
```bash
$ cd gaphor
$ source venv
$ poetry install
$ poetry run gaphor
```

111
venv
View File

@ -1,111 +0,0 @@
#!/bin/bash
#
# An easy way to set up a virtualenv.
#
# Source this file to work inside this venv:
#
# source ./venv [-f]
#
# Call `./venv -f` to force a new development installation.
#
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# If on Macos with brew, make sure we can find the brewed libffi (which is not "linked"):
printf "Are we on Macos with Homebrew installed? "
uname -a | grep -q Darwin && brew --version >/dev/null 2>&1 && {
echo "Yes"
libffi_path="$(brew ls libffi | grep pkgconfig | xargs dirname)"
echo "Adding libffi pkg-config path ${libffi_path} to \$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="${libffi_path}:${PKG_CONFIG_PATH:-}"
} || echo "No"
printf "Are we on MSys (Windows)? "
uname -a | grep -q MSYS_NT && {
echo "Yes"
export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export PATH="/mingw64/bin:${PATH}"
} || echo "No"
# shellcheck disable=SC1091,SC1090
(
# Do the whole installation process in a sub-shell, so we can safely fail when
# this file is sourced in the parent shell.
set -euo pipefail
check() {
echo Checking: "$@"
"$@" >/dev/null 2>&1
}
NO_FORCE_INSTALL=true
while getopts 'fSh' OPTION
do
case "$OPTION" in
f)
NO_FORCE_INSTALL=false
;;
S)
VENV_OPTS="--system-site-packages"
;;
h) echo "Usage: $0 [-f] [-S] [-h] # -f = force install, -S = Use system site packages, -h = this message"
exit 0 ;;
*) echo "usage: $0 [-f] [-S] [-h]" >&2
exit 1 ;;
esac
done
check python3 --version || {
echo "==> Python 3.x not found"
exit 1
}
check pkg-config --print-errors --exists 'gobject-introspection-1.0 >= 1.46.0' || {
echo "==> GObject-Introspection not found, Please check above errors and correct them"
exit 1
}
PYTHON_VER="$(python3 --version | sed 's/^Python \([0-9]\.[0-9]\).[0-9]$/\1/')"
test -d "$SCRIPT_DIR"/.venv || {
echo "Setting up a virtual env for Gaphor..."
python3 -m venv --prompt Gaphor ${VENV_OPTS:-} "$SCRIPT_DIR"/.venv
}
# shellcheck source=.venv/bin/activate
source "$SCRIPT_DIR"/.venv/bin/activate
{ ${NO_FORCE_INSTALL} && test -f "$SCRIPT_DIR"/.venv/lib/python"${PYTHON_VER}"/site-packages/gaphor.egg-link; } || {
echo "Installing Gaphor in the virtualenv..."
pip install --upgrade poetry==1.0.10
poetry install
}
test_module() {
python3 -c "$1" 2>&- || {
echo "$2"
echo
echo "The Command used to test this:"
echo
echo " >>> $1"
echo
echo "Please read the installation instructions on https://gaphor.readthedocs.io."
exit 1
}
}
test_module \
"import gi" \
"PyGobject3 (gobject-introspection) can not be loaded."
test_module \
"from gi.repository import Gtk" \
"Gtk3 is not installed in a way it can be loaded in Python."
test_module \
"import gaphor.UML" \
"Gaphor was not installed properly. Please open an issue on GitHub."
) && source "$SCRIPT_DIR"/.venv/bin/activate