~martijnbraam/pyatem

ae0cac13043aa386334f8410f86eb6ef28781cbc — Martijn Braam 1 year, 6 months ago a8d6907
update the buildsystem and readme

- Add the proxy to the meson buildsystem
- Create quick install scripts for a local install or development
- Update the readme for newer meson conventions and explain the scripts
M README.md => README.md +15 -4
@@ 10,22 10,29 @@ Installation

Install the pyatem protocol module::

    setup.py build
    sudo setup.py install

Build and install the gtk application::
Build and install the gtk application and proxy::

    meson build
    cd build
    ninja
    sudo ninja install
    meson compile -C build
    sudo meson install -C build

Run the application::

    switcher-control

There is also the `openswitcher-install.sh` script which will install the library, proxy and gtk application in
/usr/local for a quick installation of all components.

Developing
----------

To work on the `pyatem` library the quickest way to get up and running is using the `openswitcher-develop.sh` script
that will install the `pyatem` library in devel mode where the files are symlinked to the git repository. It will also
install the proxy and gtk application in /usr/local which will use the symlinked library.

Development happens on matrix on #openatem:brixit.nl

Proxy


@@ 39,6 46,10 @@ It can be run by starting the module::

    python3 -m openswitcher_proxy --config /etc/myconfigfile.toml

Or if the software installed it can be started using the launcher script::

    openswitcher-proxy --config /etc/myconfigfile.toml

The default config location is /etc/openswitcher/proxy.conf if not specified. Here's an example config:

    [[hardware]]

M meson.build => meson.build +8 -2
@@ 5,7 5,13 @@ project('switcher',

dependency('libhandy-1', version: '>=1.0.0')

subdir('data')
subdir('gtk_switcher')
if get_option('with_gtk_app')
    subdir('data')
    subdir('gtk_switcher')
endif

if get_option('with_proxy')
    subdir('openswitcher_proxy')
endif

meson.add_install_script('build-aux/meson/postinstall.py')

A meson_options.txt => meson_options.txt +2 -0
@@ 0,0 1,2 @@
option('with_proxy', type : 'boolean', value : true)
option('with_gtk_app', type : 'boolean', value : true)
\ No newline at end of file

A openswitcher-develop.sh => openswitcher-develop.sh +18 -0
@@ 0,0 1,18 @@
#!/bin/sh

# This tool sets up openswitcher and pyatem to run from the source files in the git repository. This requires root
# permissions to install the software using symlinks to the source.

printf "Installing the pyatem module using setup.py develop\n"
sudo python3 setup.py develop

printf "Installing the openswitcher application to /usr/local/\n"
meson _build
meson compile -C _build
sudo meson install -C _build

printf "*------------------------------------*\n"
printf "Development installation done\n"
printf "The python module is now available system-wide as 'pyatem'\n"
printf "The GTK application is now available as 'switcher-control'\n"
printf "The proxy application is now available as 'openswitcher-proxy'\n"
\ No newline at end of file

A openswitcher-install.sh => openswitcher-install.sh +18 -0
@@ 0,0 1,18 @@
#!/bin/sh

# This scripts installs the openswitcher components on the local system.

printf "Installing the pyatem module using setup.py install\n"
python3 setup.py build
sudo python3 setup.py install

printf "Installing the openswitcher application to /usr/local/\n"
meson _build
meson compile -C _build
sudo meson install -C _build

printf "*------------------------------------*\n"
printf "Installnstallation done\n"
printf "The python module is now available system-wide as 'pyatem'\n"
printf "The GTK application is now available as 'switcher-control'\n"
printf "The proxy application is now available as 'openswitcher-proxy'\n"
\ No newline at end of file

A openswitcher_proxy/meson.build => openswitcher_proxy/meson.build +33 -0
@@ 0,0 1,33 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'openswitcher_proxy')

python = import('python')

conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)

configure_file(
    input: 'openswitcher-proxy.in',
    output: 'openswitcher-proxy',
    configuration: conf,
    install: true,
    install_dir: get_option('bindir')
)

proxy_sources = [
    '__init__.py',
    '__main__.py',
    'frontend.py',
    'frontend_status.py',
    'frontend_tcp.py',
    'frontend_httpapi.py',
    'frontend_mqtt.py',
    'hardware.py',
    'error.py',

]

install_data(proxy_sources, install_dir: moduledir)

A openswitcher_proxy/openswitcher-proxy.in => openswitcher_proxy/openswitcher-proxy.in +17 -0
@@ 0,0 1,17 @@
#!@PYTHON@

import os
import sys
import signal
import gettext

VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'

sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    from openswitcher_proxy import __main__
    sys.exit(__main__.main())