diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-12 06:34:19 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-21 20:48:38 +0100 |
| commit | a8502ab17d8132502a4976e5feb82284d0015a6f (patch) | |
| tree | 161315b414a0aa3fdd80a80c83cafda62ba8c3d9 /client/diagnose.py | |
| parent | 14048683e29b6486aa1e680e29d78de97fc92d7d (diff) | |
| download | jasper-client-a8502ab17d8132502a4976e5feb82284d0015a6f.tar.gz jasper-client-a8502ab17d8132502a4976e5feb82284d0015a6f.zip | |
Added extra diagnostics
- Check if say or espeak are installed
- Check if all pip requirements were installed
Diffstat (limited to 'client/diagnose.py')
| -rwxr-xr-x | client/diagnose.py | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/client/diagnose.py b/client/diagnose.py index 28cd9c8..5249965 100755 --- a/client/diagnose.py +++ b/client/diagnose.py @@ -3,8 +3,9 @@ import time import re import socket import os -from subprocess import check_output, call import jasperpath +import subprocess +from distutils.spawn import find_executable class Diagnostics: @@ -36,11 +37,33 @@ class Diagnostics: @classmethod def check_phonetisaurus_program(cls): - return call(['which', 'phonetisaurus-g2p']) == 0 + return cls.do_check_program('phonetisaurus-g2p') + + @classmethod + def check_espeak_program(cls): + return cls.do_check_program('espeak') + + @classmethod + def check_say_program(cls): + return cls.do_check_program('say') + + @classmethod + def do_check_program(cls, program): + return find_executable(program) is not None + + @classmethod + def check_all_pip_requirements_installed(cls): + try: + cmd = ['pip', 'install', '-r', 'requirements.txt', '--no-install', '--no-download'] + reqs = subprocess.check_output(cmd) + except subprocess.CalledProcessError: + return False + else: + return True @classmethod def info_git_revision(cls): - return check_output(['git', 'rev-parse', 'HEAD']) + return subprocess.check_output(['git', 'rev-parse', 'HEAD']) class DiagnosticRunner: |
