make setup.py initial work

This commit is contained in:
chrys 2017-05-25 13:43:33 +02:00
parent bbce7caba9
commit e39a5b301c
6 changed files with 24 additions and 72 deletions

View File

@ -1,48 +0,0 @@
#!/bin/python
import os
from setuptools import find_packages
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
# Application name:
name="fenrir",
# Version number (initial):
version="0.1a",
# Application author details:
author="Chrys and others",
author_email="chrys87@web.de",
# Packages
packages=find_packages('src/fenrir'),
package_dir={'': 'src/fenrir'},
scripts=['src/fenrir/fenrir','src/fenrir/fenrir-daemon'],
#entry_points = {
# "console_scripts": ['fenrir = fenrir:main']
# },
# Include additional files into the package
include_package_data=True,
# Details
url="https://github.com/chrys87/fenrir/",
zip_safe=False,
#
# license="MIT",
description="An TTY Screen Reader For Linux.",
long_description=read('README.md'),
classifiers=[
"Development Status :: 3 - Alpha",
],
# Dependent packages (distributions)
install_requires=[
"evdev",
"sox",
],
)

View File

@ -5,7 +5,7 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import glob, os, time import glob, os, time
import __main__ import fenrirVersion
from core import debug from core import debug
from utils import module_utils from utils import module_utils
@ -29,7 +29,7 @@ class commandManager():
def loadCommands(self, section='commands',commandPath=''): def loadCommands(self, section='commands',commandPath=''):
if commandPath =='': if commandPath =='':
commandPath = os.path.dirname(os.path.realpath(__main__.__file__))+ "/commands/" commandPath = os.path.dirname(os.path.realpath(fenrirVersion.__file__))+ "/commands/"
if not commandPath.endswith('/'): if not commandPath.endswith('/'):
commandPath += '/' commandPath += '/'
commandFolder = commandPath + section +"/" commandFolder = commandPath + section +"/"
@ -73,8 +73,8 @@ class commandManager():
if not scriptPath.endswith('/'): if not scriptPath.endswith('/'):
scriptPath += '/' scriptPath += '/'
if not os.path.exists(scriptPath): if not os.path.exists(scriptPath):
if os.path.exists(os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/'): if os.path.exists(os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/scripts/'):
scriptPath = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/' scriptPath = os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/scripts/'
else: else:
self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.WARNING) self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.WARNING)
return return
@ -85,7 +85,7 @@ class commandManager():
self.env['runtime']['debug'].writeDebugOut("scriptpath not readable:" + scriptPath ,debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut("scriptpath not readable:" + scriptPath ,debug.debugLevel.ERROR)
return return
commandList = glob.glob(scriptPath+'*') commandList = glob.glob(scriptPath+'*')
subCommand = os.path.dirname(os.path.realpath(__main__.__file__)) + '/commands/commands/subprocess.py' subCommand = os.path.dirname(os.path.realpath(fenrirVersion.__file__)) + '/commands/commands/subprocess.py'
for command in commandList: for command in commandList:
invalid = False invalid = False
try: try:

View File

@ -5,10 +5,10 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import os, sys, signal, time import os, sys, signal, time
import __main__ import fenrirVersion
if not os.path.dirname(os.path.realpath(__main__.__file__)) in sys.path: if not os.path.dirname(os.path.realpath(fenrirVersion.__file__)) in sys.path:
sys.path.append(os.path.dirname(os.path.realpath(__main__.__file__))) sys.path.append(os.path.dirname(os.path.realpath(fenrirVersion.__file__)))
from core import i18n from core import i18n
from core import settingsManager from core import settingsManager

View File

@ -5,7 +5,7 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import os import os
import __main__ import fenrirVersion
from configparser import ConfigParser from configparser import ConfigParser
from core import eventManager from core import eventManager
from core import inputManager from core import inputManager
@ -29,7 +29,7 @@ class settingsManager():
self.env = environment self.env = environment
def shutdown(self): def shutdown(self):
pass pass
def loadShortcuts(self, kbConfigPath=os.path.dirname(os.path.realpath(__main__.__file__)) + '/../../config/keyboard/desktop.conf'): def loadShortcuts(self, kbConfigPath=os.path.dirname(os.path.realpath(fenrirVersion.__file__)) + '/../../config/keyboard/desktop.conf'):
kbConfig = open(kbConfigPath,"r") kbConfig = open(kbConfigPath,"r")
while(True): while(True):
invalid = False invalid = False
@ -103,7 +103,7 @@ class settingsManager():
def isValidKey(self, key): def isValidKey(self, key):
return key in inputData.keyNames return key in inputData.keyNames
def loadDicts(self, dictConfigPath=os.path.dirname(os.path.realpath(__main__.__file__)) + '/../../config/punctuation/default.conf'): def loadDicts(self, dictConfigPath=os.path.dirname(os.path.realpath(fenrirVersion.__file__)) + '/../../config/punctuation/default.conf'):
dictConfig = open(dictConfigPath,"r") dictConfig = open(dictConfigPath,"r")
currDictName = '' currDictName = ''
while(True): while(True):
@ -201,7 +201,7 @@ class settingsManager():
if self.env['runtime'][driverType] != None: if self.env['runtime'][driverType] != None:
self.env['runtime'][driverType].shutdown(self.env) self.env['runtime'][driverType].shutdown(self.env)
driver_mod = module_utils.importModule(driverName, driver_mod = module_utils.importModule(driverName,
os.path.dirname(os.path.realpath(__main__.__file__)) + "/" + driverType + '/' + driverName + '.py') os.path.dirname(os.path.realpath(fenrirVersion.__file__)) + "/" + driverType + '/' + driverName + '.py')
self.env['runtime'][driverType] = driver_mod.driver() self.env['runtime'][driverType] = driver_mod.driver()
self.env['runtime'][driverType].initialize(self.env) self.env['runtime'][driverType].initialize(self.env)
self.env['runtime']['debug'].writeDebugOut('Loading Driver ' + driverType + ' (' + driverName +") OK",debug.debugLevel.INFO, onAnyLevel=True) self.env['runtime']['debug'].writeDebugOut('Loading Driver ' + driverType + ' (' + driverName +") OK",debug.debugLevel.INFO, onAnyLevel=True)
@ -250,8 +250,8 @@ class settingsManager():
environment['runtime']['debug'].initialize(environment) environment['runtime']['debug'].initialize(environment)
# get fenrir settings root # get fenrir settings root
if not os.path.exists(settingsRoot): if not os.path.exists(settingsRoot):
if os.path.exists(os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/'): if os.path.exists(os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/'):
settingsRoot = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/' settingsRoot = os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/'
else: else:
return None return None
# get settings file # get settings file
@ -262,8 +262,8 @@ class settingsManager():
return None return None
# get sound themes root # get sound themes root
if not os.path.exists(soundRoot): if not os.path.exists(soundRoot):
if os.path.exists(os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/sound/'): if os.path.exists(os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/sound/'):
soundRoot = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/sound/' soundRoot = os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/sound/'
environment['runtime']['settingsManager'] = self environment['runtime']['settingsManager'] = self
environment['runtime']['settingsManager'].initialize(environment) environment['runtime']['settingsManager'].initialize(environment)

View File

@ -5,10 +5,10 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import os, sys import os, sys
import __main__ import fenrirVersion
if not os.path.dirname(os.path.realpath(__main__.__file__)) in sys.path: if not os.path.dirname(os.path.realpath(fenrirVersion.__file__)) in sys.path:
sys.path.append(os.path.dirname(os.path.realpath(__main__.__file__))) sys.path.append(os.path.dirname(os.path.realpath(fenrirVersion.__file__)))
from core import fenrirManager from core import fenrirManager

View File

@ -5,10 +5,10 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import os, sys import os, sys
import __main__ import fenrirVersion
if not os.path.dirname(os.path.realpath(__main__.__file__)) in sys.path: if not os.path.dirname(os.path.realpath(fenrirVersion.__file__)) in sys.path:
sys.path.append(os.path.dirname(os.path.realpath(__main__.__file__))) sys.path.append(os.path.dirname(os.path.realpath(fenrirVersion.__file__)))
from core import fenrirManager from core import fenrirManager
from daemonize import Daemonize from daemonize import Daemonize
@ -22,7 +22,7 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
# for debug in foreground # for debug in foreground
#daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, foreground=True,chdir=os.path.dirname(os.path.realpath(__main__.__file__))) #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(__main__.__file__))) daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, chdir=os.path.dirname(os.path.realpath(fenrirVersion.__file__)))
daemon.start() daemon.start()