diff --git a/.gitignore b/.gitignore index 0d20b64..b47a46d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.pyc +*.py[cod] +debian/ahenk/* +debian/ahenk diff --git a/debian/ahenk.install b/debian/ahenk.install new file mode 100644 index 0000000..99c3db7 --- /dev/null +++ b/debian/ahenk.install @@ -0,0 +1,3 @@ +opt/ / +etc/ / +lib/ / diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..d665d98 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ahenk (1.0) unstable; urgency=low + + * Ahenk core app + + -- ismail.basaran Thu, 10 Dec 2015 22:21:04 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..218c0be --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: ahenk +Section: unknown +Priority: optional +Maintainer: TUBITAK ULAKBIM +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.5 +Homepage: http://www.liderahenk.org.tr + +Package: ahenk +Architecture: any +Depends:python-deamon, python2.7 (>= 2.7.3) +Description: LiderAhenk agent application + Long Desc diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..8bc2437 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +ahenk_1.0_amd64.deb unknown optional diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..cfe67d3 --- /dev/null +++ b/debian/rules @@ -0,0 +1,28 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#DH_VERBOSE = 1 + +# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +# main packaging script based on dh7 syntax +%: + dh $@ + +# debmake generated override targets +# This is example for Cmake (See http://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- \ +# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) diff --git a/opt/ahenk/base/logging/__init__.py b/opt/ahenk/__init__.py similarity index 100% rename from opt/ahenk/base/logging/__init__.py rename to opt/ahenk/__init__.py diff --git a/opt/ahenk/ahenkd.py b/opt/ahenk/ahenkd.py index 0d3c6c1..8ef51ea 100644 --- a/opt/ahenk/ahenkd.py +++ b/opt/ahenk/ahenkd.py @@ -1,11 +1,12 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: İsmail BAŞARAN from base.config.ConfigManager import ConfigManager from base.deamon.BaseDeamon import BaseDeamon -from base.logging.AhenkLogger import Logger +from base.logger.AhenkLogger import AhenkLogger from base.Scope import Scope +#from base.messaging.Messaging import Messaging import sys,logging @@ -32,18 +33,18 @@ class AhenkDeamon(BaseDeamon): config = configManager.read() globalscope.setConfigurationManager(config) - logger = Logger() - logger.info("obaraaa") - globalscope.setLogger(logger) - - - - + #logger = AhenkLogger() + #logger.info("obaraaa") + #globalscope.setLogger(logger) + #messaging=Messaging() + #messaging.connectToServer() if __name__ == '__main__': - + print "hello" + print sys.path +""" pidfilePath='/var/run/ahenk.pid' deamon = AhenkDeamon(pidfilePath) @@ -65,3 +66,4 @@ if __name__ == '__main__': else: print 'Usage : %s start|stop|restart|status' % sys.argv[0] sys.exit(2) +""" diff --git a/opt/ahenk/base/deamon/BaseDeamon.pyc b/opt/ahenk/base/deamon/BaseDeamon.pyc deleted file mode 100644 index 0b13e13..0000000 Binary files a/opt/ahenk/base/deamon/BaseDeamon.pyc and /dev/null differ diff --git a/opt/ahenk/base/deamon/__init__.pyc b/opt/ahenk/base/deamon/__init__.pyc deleted file mode 100644 index 92635a3..0000000 Binary files a/opt/ahenk/base/deamon/__init__.pyc and /dev/null differ diff --git a/opt/ahenk/base/logger/AhenkLogger.py b/opt/ahenk/base/logger/AhenkLogger.py new file mode 100644 index 0000000..d9d38c0 --- /dev/null +++ b/opt/ahenk/base/logger/AhenkLogger.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Author: İsmail BAŞARAN +import sys +import logging +import logging.config +sys.path.insert(0,'/home/ismail/devzone/workspace/lider-ahenk/ahenk/opt/ahenk/') +#import ahenkd + +class AhenkLogger(object): + """docstring for Logger""" + def __init__(self): + super(Logger, self).__init__() + scope = ahenkd.AhenkDeamon.scope() + configManager = scope.getConfigurationManager() + + logging.config.fileConfig(configManager.get('BASE','logConfigurationFilePath')) + self.logger = logging.getLogger() + + def getLogger(self): + return self.logger + + def info(self,logstring): + self.logger.info(logstring) + + def warning(self,logstring): + self.logger.warning(logstring) + + def error(self,logstring): + self.logger.error(logstring) + + def debug(self,logstring): + self.logger.debug(logstring) + + +if __name__ == '__main__': + print "hello" + print sys.path diff --git a/opt/ahenk/base/logger/__init__.py b/opt/ahenk/base/logger/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/opt/ahenk/base/logging/AhenkLogger.py b/opt/ahenk/base/logging/AhenkLogger.py index f130202..58dcc30 100644 --- a/opt/ahenk/base/logging/AhenkLogger.py +++ b/opt/ahenk/base/logging/AhenkLogger.py @@ -1,12 +1,13 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: İsmail BAŞARAN - +import sys +sys.path.append('../..') import logging import logging.config from ahenkd import AhenkDeamon -class Logger(object): +class AhenkLogger(object): """docstring for Logger""" def __init__(self): super(Logger, self).__init__() diff --git a/opt/ahenk/base/messaging/Messaging.py b/opt/ahenk/base/messaging/Messaging.py index d638436..aa88b38 100644 --- a/opt/ahenk/base/messaging/Messaging.py +++ b/opt/ahenk/base/messaging/Messaging.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- # Author: Volkan Şahin # Author: İsmail BAŞARAN - -import configparser +import sys +sys.path.append('../..') import slixmpp from slixmpp.exceptions import IqError, IqTimeout from ahenkd import AhenkDeamon