diff --git a/setup.py b/setup.py index afca2691..53e9ba0f 100755 --- a/setup.py +++ b/setup.py @@ -1,9 +1,34 @@ #!/bin/python #https://python-packaging.readthedocs.io/en/latest/minimal.html -import os +import os, glob from setuptools import find_packages from setuptools import setup fenrirVersion = '1.5' + +data_files = [] +directories = glob.glob('config/*') +for directory in directories: + files = glob.glob(directory+'/*') + destDir = '' + if 'config/punctuation' in directory : + destDir = '/etc/fenrir/punctuation' + elif 'config/keyboard' in directory: + destDir = '/etc/fenrir/keyboard' + elif 'config/settings' in directory: + destDir = '/etc/fenrir/settings' + elif 'config/scripts' in directory: + destDir = '/usr/share/fenrir/scripts' + elif 'config/sound' in directory: + if "default-wav" in directory: + destDir = '/usr/share/sounds/fenrir/default-wav' + elif "default" in directory: + destDir = '/usr/share/sounds/fenrir/default' + elif "template" in directory: + destDir = '/usr/share/sounds/fenrir/template' + if destDir != '': + data_files.append((destDir, files)) + data_files.append(('/usr/lib/systemd/system/', 'autostart/systemd/fenrir.service')) + def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() @@ -38,6 +63,8 @@ setup( # Include additional files into the package include_package_data=True, zip_safe=False, + + data_files=data_files, # Dependent packages (distributions) install_requires=[ @@ -45,6 +72,7 @@ setup( "sox", "dbus-python", "pyenchant", + "pyudev", "setuptools", ], diff --git a/src/fenrir/core/commandManager.py b/src/fenrir/core/commandManager.py index 9663301d..9a6060ea 100644 --- a/src/fenrir/core/commandManager.py +++ b/src/fenrir/core/commandManager.py @@ -5,7 +5,7 @@ # By Chrys, Storm Dragon, and contributers. import glob, os, time, inspect -currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +currentdir = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) fenrirPath = os.path.dirname(currentdir) from core import debug diff --git a/src/fenrir/core/settingsManager.py b/src/fenrir/core/settingsManager.py index b09329f9..8b6846aa 100644 --- a/src/fenrir/core/settingsManager.py +++ b/src/fenrir/core/settingsManager.py @@ -5,7 +5,7 @@ # By Chrys, Storm Dragon, and contributers. import os, inspect -currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +currentdir = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) fenrirPath = os.path.dirname(currentdir) from configparser import ConfigParser diff --git a/src/fenrir/fenrir b/src/fenrir/fenrir index 24aa6264..d8107dfe 100755 --- a/src/fenrir/fenrir +++ b/src/fenrir/fenrir @@ -5,7 +5,7 @@ # By Chrys, Storm Dragon, and contributers. import os, sys, inspect -fenrirPath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +fenrirPath = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) if not fenrirPath in sys.path: sys.path.append(fenrirPath) diff --git a/src/fenrir/fenrir-daemon b/src/fenrir/fenrir-daemon index 8d5531fb..eefc5054 100755 --- a/src/fenrir/fenrir-daemon +++ b/src/fenrir/fenrir-daemon @@ -4,11 +4,11 @@ # Fenrir TTY screen reader # By Chrys, Storm Dragon, and contributers. -import os, sys -import fenrirVersion +import os, sys, inspect +fenrirPath = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) -if not os.path.dirname(os.path.realpath(fenrirVersion.__file__)) in sys.path: - sys.path.append(os.path.dirname(os.path.realpath(fenrirVersion.__file__))) +if not fenrirPath in sys.path: + sys.path.append(fenrirPath) from core import fenrirManager from daemonize import Daemonize @@ -23,6 +23,6 @@ def main(): if __name__ == "__main__": # for debug in foreground #daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, foreground=True,chdir=os.path.dirname(os.path.realpath(fenrirVersion.__file__))) - daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, chdir=os.path.dirname(os.path.realpath(fenrirVersion.__file__))) + daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, chdir=fenrirPath) daemon.start()