summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/devguide/dev_environ.rst202
-rw-r--r--docs/getting_started.rst80
2 files changed, 220 insertions, 62 deletions
diff --git a/docs/devguide/dev_environ.rst b/docs/devguide/dev_environ.rst
index 081cd775..89d8693e 100644
--- a/docs/devguide/dev_environ.rst
+++ b/docs/devguide/dev_environ.rst
@@ -1,48 +1,216 @@
.. include:: ../icons.rst
+.. _devenv:
+
==================================
Creating a Development Environment
==================================
-This describes how to work on PyGObject itself. Please follow the instructions
-on ":ref:`gettingstarted`" first, as they are a pre-requirement.
+This describes how to setup a development environment for working on a project
+that uses PyGObject, or for working on PyGObject itself. Please follow the
+instructions on ":ref:`gettingstarted`" first, as they are a pre-requirement.
+
+.. _pipenv:
+
+************
+Pipenv Setup
+************
+.. _ubuntu:
|ubuntu-logo| Ubuntu / |debian-logo| Debian
-------------------------------------------
.. code:: console
- sudo apt build-dep pygobject
- sudo apt install autoconf-archive python3-pytest python3-flake8
- git clone https://gitlab.gnome.org/GNOME/pygobject.git
- cd pygobject
- ./autogen.sh
- make
- make check
+ sudo apt-get install -y python3-venv python3-wheel
+ sudo apt-get install -y libgirepository1.0-dev build-essential \
+ libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget \
+ curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
+ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
+ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
+ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
+ ~/.pyenv/bin/pyenv install 3.6.4
+ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
+ ~/.local/bin/pipsi install pew
+ ~/.local/bin/pipsi install pipenv
+
+
+.. _fedora:
+|fedora-logo| Fedora
+--------------------
+
+.. code:: console
+
+
+ sudo dnf install -y python3-venv python3-wheel
+ sudo dnf install -y gcc zlib-devel bzip2 bzip2-devel readline-devel \
+ sqlite sqlite-devel openssl-devel tk-devel git python3-cairo-devel \
+ cairo-gobject-devel gobject-introspection-devel
+ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
+ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
+ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
+ ~/.pyenv/bin/pyenv install 3.6.4
+ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
+ ~/.local/bin/pipsi install pew
+ ~/.local/bin/pipsi install pipenv
+
+
+.. _arch:
+
+|arch-logo| Arch Linux
+----------------------
+
+.. code:: console
+
+ sudo pacman -S --noconfirm python-virtualenv python-wheel
+ sudo pacman -S --noconfirm base-devel openssl zlib git gobject-introspection
+ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
+ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
+ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
+ ~/.pyenv/bin/pyenv install 3.6.4
+ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
+ ~/.local/bin/pipsi install pew
+ ~/.local/bin/pipsi install pipenv
+
+
+.. _opensuse:
+
+|opensuse-logo| openSUSE
+------------------------
+
+.. code:: console
+
+ sudo zypper install -y python3-venv python3-wheel gobject-introspection \
+ python3-cairo-devel openssl zlib git
+ sudo zypper install --type pattern devel_basis
+ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
+ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
+ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
+ ~/.pyenv/bin/pyenv install 3.6.4
+ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
+ ~/.local/bin/pipsi install pew
+ ~/.local/bin/pipsi install pipenv
+
+.. _windows:
|windows-logo| Windows
----------------------
+TODO: currently no way to install pyenv in Windows
+
.. code:: console
pacman -S --needed --noconfirm base-devel mingw-w64-i686-toolchain git \
- mingw-w64-i686-python3 mingw-w64-i686-python3-cairo \
- mingw-w64-i686-gobject-introspection mingw-w64-i686-gtk3 \
- mingw-w64-i686-libffi autoconf-archive mingw-w64-i686-python3-pytest \
- mingw-w64-i686-python3-pip
- pip3 install --user flake8
+ mingw-w64-i686-python3 mingw-w64-i686-python3-cairo \
+ mingw-w64-i686-gobject-introspection mingw-w64-i686-libffi
+ virtualenv --python 3 myvenv
+ source myvenv/bin/activate
+
+
+|macosx-logo| macOS
+-------------------
+
+.. code:: console
+
+ brew install pyenv
+ pyenv install 3.6.4
+ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile
+ ~/.local/bin/pipsi install pew
+ ~/.local/bin/pipsi install pipenv
+
+
+.. _otherprojects:
+
+************************************
+Projects with PyGObject Dependencies
+************************************
+
+If you are going to work on a project that has PyGObject as a dependency, then
+do the following additional steps:
+
+.. code:: console
+
+ git clone <url/projectname.git>
+ cd projectname
+ pipenv --python 3
+ pipenv install pycairo
+ pipenv install pygobject
+ pipenv shell
+
+
+.. _pygobjectwork:
+
+*****************
+Work on PyGObject
+*****************
+
+If you are going to work on developing PyGObject itself, then do the following
+additional steps:
+
+.. code:: console
+
git clone https://gitlab.gnome.org/GNOME/pygobject.git
cd pygobject
+ pipenv --python 3
+ pipenv install pytest
+ pipenv install flake8
+ pipenv shell
+
+
+.. _ubuntu:
+
+|ubuntu-logo| Ubuntu / |debian-logo| Debian
+-------------------------------------------
+
+.. code:: console
+
+ sudo apt build-dep pygobject
+ sudo apt install autoconf-archive
./autogen.sh
make
make check
-|macosx-logo| macOS
--------------------
+.. _fedora:
+
+|fedora-logo| Fedora
+--------------------
+
+ sudo dnf builddep pygobject
+ ./autogen.sh
+ make
+ make check
+
+
+ .. _arch:
+
+|arch-logo| Arch Linux
+----------------------
.. code:: console
- # TODO
+ makepkg -s pygobject
+ ./autogen.sh
+ make
+ make check
+
+
+.. _windows:
+
+|windows-logo| Windows
+----------------------
+ pacman -S --needed --noconfirm autoconf-archive
+ ./autogen.sh
+ make
+ make check \ No newline at end of file
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 030af55e..fe2a6a44 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -22,15 +22,8 @@ the following content and save it somewhere:
window.connect("destroy", Gtk.main_quit)
Gtk.main()
-
-.. _pypi:
-
-|python-logo| From PyPI
------------------------
-Before we can run the example application we need to install PyGObject, GTK+ and
-their dependencies. Although not strictly required, the recommend way to run
-PyGObject is from within a virtual environment and using pip. Follow the
-instructions for your platform below.
+Before we can run the example application we need to install PyGObject, GTK+
+and their dependencies. Follow the instructions for your platform below.
======================================= ==================================== ==================================== ==========================================
|ubuntu-logo| :ref:`Ubuntu <ubuntu>` |fedora-logo| :ref:`Fedora <fedora>` |arch-logo| :ref:`Arch Linux <arch>` |opensuse-logo| :ref:`openSUSE <opensuse>`
@@ -46,7 +39,7 @@ instructions for your platform below.
1) Go to http://www.msys2.org/ and download the x86_64 installer
2) Follow the instructions on the page for setting up the basic environment
3) Run ``C:\msys64\mingw32.exe`` - a terminal window should pop up
-4) Execute ``pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobject mingw-w64-i686-python3-gobject mingw-w64-i686-gobject-introspection``
+4) Execute ``pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobject mingw-w64-i686-python3-gobject``
5) To test that GTK+3 is working you can run ``gtk3-demo``
6) Copy the ``hello.py`` script you created to ``C:\msys64\home\<username>``
7) In the mingw32 terminal execute ``python3 hello.py`` - a window should appear.
@@ -61,13 +54,9 @@ instructions for your platform below.
-------------------------------------------
1) Open a terminal
-2) Execute ``sudo apt install python-gi python-gi-cairo python3-gi python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev``
-3) Execute ``virtualenv --python=python3 myvenv``
-4) Execute ``source myvenv/bin/activate``
-5) Execute ``pip install pycairo``
-6) Execute ``pip install pygobject``
-7) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
-8) Run ``python3 hello.py``
+2) Execute ``sudo apt install python-gi python-gi-cairo python3-gi python3-gi-cairo gir1.2-gtk-3.0``
+3) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
+4) Run ``python3 hello.py``
.. figure:: images/start_linux.png
:scale: 60%
@@ -79,13 +68,9 @@ instructions for your platform below.
--------------------
1) Open a terminal
-2) Execute ``sudo dnf install pygobject3 python3-gobject gtk3 gobject-introspection-devel python3-cairo-devel cairo-gobject-devel``
-3) Execute ``virtualenv --python=python3 myvenv``
-4) Execute ``source myvenv/bin/activate``
-5) Execute ``pip install pycairo``
-6) Execute ``pip install pygobject``
-7) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
-8) Run ``python3 hello.py``
+2) Execute ``sudo dnf install pygobject3 python3-gobject gtk3``
+3) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
+4) Run ``python3 hello.py``
.. _arch:
@@ -94,13 +79,9 @@ instructions for your platform below.
----------------------
1) Open a terminal
-2) Execute ``sudo pacman -S python-gobject python2-gobject gtk3 gobject-introspection``
-3) Execute ``virtualenv --python=python3 myvenv``
-4) Execute ``source myvenv/bin/activate``
-5) Execute ``pip install pycairo``
-6) Execute ``pip install pygobject``
-7) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
-8) Run ``python3 hello.py``
+2) Execute ``sudo pacman -S python-gobject python2-gobject gtk3``
+3) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
+4) Run ``python3 hello.py``
.. _opensuse:
@@ -109,13 +90,9 @@ instructions for your platform below.
------------------------
1) Open a terminal
-2) Execute ``sudo zypper install python-gobject python3-gobject gtk3 gobject-introspection python3-cairo-devel cairo-gobject-devel``
-3) Execute ``virtualenv --python=python3 myvenv``
-4) Execute ``source myvenv/bin/activate``
-5) Execute ``pip install pycairo``
-6) Execute ``pip install pygobject``
-7) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
-8) Run ``python3 hello.py``
+2) Execute ``sudo zypper install python-gobject python3-gobject gtk3``
+3) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
+4) Run ``python3 hello.py``
.. _macosx:
@@ -126,13 +103,26 @@ instructions for your platform below.
1) Go to https://brew.sh/ and install homebrew
2) Open a terminal
3) Execute ``brew install pygobject3 --with-python3 gtk+3`` to install for both python2 and python3
-4) Execute ``brew install gobject-introspection``
-5) Execute ``virtualenv --python=python3 myvenv``
-6) Execute ``source myvenv/bin/activate``
-7) Execute ``pip install pycairo``
-8) Execute ``pip install pygobject``
-9) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
-10) Run ``python3 hello.py``
+4) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``)
+5) Run ``python3 hello.py``
.. figure:: images/start_macos.png
:scale: 70%
+
+
+.. _pypi:
+
+|python-logo| From PyPI
+-----------------------
+
+PyGObject is also available on PyPI: https://pypi.org/project/PyGObject
+
+For this approach you have to make sure that all runtime and build
+dependencies are present yourself as pip will only take care of pycairo.
+
+.. code::
+
+ virtualenv --python=python3 myvenv
+ source myvenv/bin/activate
+ pip install pygobject
+ python hello.py