Commit 629e9453 authored by frnmst's avatar frnmst
Browse files

Fixed documentation and code.

parent 15926c81
Configuration File
==================
Definition
----------
The configuration file holds all relevant information of your Kalliope setup.
Paths
-----
The configuration file must lie in:
::
~/.config/kalliope_rest/kalliope_rest.conf
Example
-------
What follows is an example of configuration file which is included in
this repository
......
Requirement files
=================
Definition
----------
The requirement files contain a list of extra APT and PIP packages which are
parsed by Kalliope Docker. These requirements are not included as part of the
resources.
Paths
-----
TODO.
Requirements files
==================
Definition
----------
The requirements files contain a list of standard APT and PIP packages which are
parsed by Kalliope Docker. These requirements are not included as part of the
resources so they need to be specified manually.
Paths
-----
If you use the script without installing it:
::
./kalliope_docker/includes/requirements/standard_apt_pakages.txt
./kalliope_docker/includes/requirements/standard_pip_pakages.txt
If you run the setup, a copy of both requirements file will be placed in your
Python dist directory such as:
::
/usr/lib/python3.6/site-packages/kalliope_docker/includes/requirements/standard_apt_packages.txt
/usr/lib/python3.6/site-packages/kalliope_docker/includes/requirements/standard_pip_packages.txt
You can also place these files in the user's configuration directory
::
~/.config/kalliope_docker/requirements/standard_apt_packages.txt
~/.config/kalliope_docker/requirements/standard_pip_packages.txt
Example
-------
- ``standard_apt_packages.txt``
::
curl
git
python-dev
libsmpeg0
flac
libffi-dev
libssl-dev
portaudio19-dev
build-essential
libssl-dev
libffi-dev
sox
libatlas3-base
mplayer
locales
libav-tools
- ``standard_apt_packages.txt``
::
kalliope
......@@ -21,6 +21,7 @@
# SOFTWARE.
"""A file that contains all the global constants."""
import pkg_resources
from pathlib import Path
home_directory = str(Path.home())
......@@ -44,13 +45,27 @@ docker_volumes['audio'] = '/dev/snd:/dev/snd:rwm'
file_paths = dict()
file_paths[
'config_directory'] = home_directory + '/' + '.config/kalliope_docker'
file_paths[
'apt_requirements'] = 'includes/requirements/standard_apt_packages.txt'
file_paths[
'pip_requirements'] = 'includes/requirements/standard_pip_packages.txt'
file_paths[
'kalliope_docker_configuration'] = file_paths['config_directory'] + '/' + 'kalliope_docker.conf'
# These files should be under ~/.config/kalliope_docker/.
# If not, find a suitable path.
if Path(file_paths['config_directory'] + ' ' + '/' + 'standard_apt_packages.txt').is_file():
file_paths['apt_requirements'] = file_paths['config_directory'] + '/' + 'requirements/standard_apt_packages.txt'
elif pkg_resources.resource_exists('kalliope_docker', 'includes/requirements/standard_apt_packages.txt'):
file_paths['apt_requirements'] = pkg_resources.resource_filename('kalliope_docker', 'includes/requirements/standard_apt_packages.txt')
else:
file_paths[
'apt_requirements'] = 'includes/requirements/standard_apt_packages.txt'
if Path(file_paths['config_directory'] + ' ' + '/' + 'standard_pip_packages.txt').is_file():
file_paths['pip_requirements'] = file_paths['config_directory'] + '/' + 'requirements/standard_pip_packages.txt'
elif pkg_resources.resource_exists('kalliope_docker', 'includes/requirements/standard_pip_packages.txt'):
file_paths['pip_requirements'] = pkg_resources.resource_filename('kalliope_docker', 'includes/requirements/standard_pip_packages.txt')
else:
file_paths[
'pip_requirements'] = 'includes/requirements/standard_pip_packages.txt'
# The final profile that gets copied under
# configuration_fallback['base_directory_full_path']
file_paths['target_profile_directory'] = 'target'
......@@ -79,5 +94,6 @@ cmu_sphinx['language_models'][
cmu_sphinx['language_models']['fr-FR'] = 'https://db.tt/tVNcZXao'
cmu_sphinx['language_models']['zh-CN'] = 'https://db.tt/2YQVXmEk'
if __name__ == '__main__':
pass
......@@ -410,12 +410,12 @@ def stop_docker_container(docker_image_tag):
# Get all running containers.
command = 'docker ps --format "{{.ID}} {{.Image}}"'
running_containers = subprocess.run(
command, shell=True,
command, shell=True, check=True,
stdout=subprocess.PIPE).stdout.strip().decode('utf-8').split('\n')
for container in running_containers:
sublist = container.split(' ')
if sublist[1] == vars['docker_image_tag']:
if sublist != [''] and sublist[1] == vars['docker_image_tag']:
container_id = sublist[0]
command = "docker stop" + " " + container_id
subprocess.run(command, shell=True, check=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment