diff --git a/HouseAgent.conf b/HouseAgent.conf index adabd28..c4acbbf 100644 --- a/HouseAgent.conf +++ b/HouseAgent.conf @@ -22,7 +22,6 @@ logsize=1024 logcount=5 logconsole=True dbpath= - runasservice=False # ----------------------------------------------------------------------------- diff --git a/debian/changelog b/debian/changelog index eaf1673..13c7524 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,22 @@ +houseagent (0.01.20111116-2215-0ubuntu1) lucid; urgency=low + + * Minor fixes and upstream changes. + + -- David Whyte Wed, 16 Nov 2011 22:16:15 +1000 + +houseagent (0.01.20111107-1217-0ubuntu1) lucid; urgency=low + + * Changed the revision numbering to better support development packages. + * Created an upstart job for monitoring and management of HouseAgent. + + -- David Whyte Mon, 07 Nov 2011 12:18:14 +1000 + +houseagent (0.01.3-0ubuntu1) lucid; urgency=low + + * Update to GIT revision 0efb44d. Remove dependency on RabbitMQ, add dependency on ZeroMQ. + + -- David Whyte Sun, 06 Nov 2011 23:11:11 +1000 + houseagent (0.01-0ubuntu2) lucid; urgency=low * Minor modifications of the packaging meta-data diff --git a/debian/control b/debian/control index cc217e7..8c26adc 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,6 @@ Homepage: http://projects.maartendamen.com/projects/houseagent Package: houseagent Architecture: all -Depends: ${misc:Depends}, ${python:Depends}, rabbitmq-server, python-twisted-web, python-mako, python-pyrrd, python-txamqp, twisted.scheduling +Depends: ${misc:Depends}, ${python:Depends}, python-pyzmq, python-twisted-web, python-mako, python-pyrrd, python-txamqp, twisted.scheduling, txzmq Description: Home automation core framework. HouseAgent is a multi platform, open source home automation application. diff --git a/deploy/houseagent.conf b/deploy/houseagent.conf new file mode 100644 index 0000000..195a12e --- /dev/null +++ b/deploy/houseagent.conf @@ -0,0 +1,11 @@ +description "HouseAgent management daemon" +author "David Whyte" + +start on started network +stop on stopping network +stop on starting shutdown + +console output + +exec python /usr/bin/HouseAgent.py +respawn \ No newline at end of file diff --git a/houseagent/__init__.py b/houseagent/__init__.py index 52bbb77..7884f1f 100644 --- a/houseagent/__init__.py +++ b/houseagent/__init__.py @@ -17,8 +17,9 @@ def config_file(): # Windows if os.name == 'nt': - from win32com.shell import shellcon, shell - config_file = config_file = os.path.join(shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0), 'HouseAgent', 'HouseAgent.conf') + from win32com.shell import shellcon, shell + config_dir = os.path.join(shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0), 'HouseAgent') + config_file = os.path.join(config_dir, 'HouseAgent.conf') if hasattr(sys, 'frozen'): # Special case for binary Windows version @@ -27,22 +28,23 @@ def config_file(): return config_file elif os.path.exists(os.path.join(os.getcwd(), 'HouseAgent.conf')): # development - return os.path.join(os.getcwd(), 'HouseAgent.conf') + return os.getcwd(), os.path.join(os.getcwd(), 'HouseAgent.conf') else: raise ConfigFileNotFound("ProgramData or working directory.") # OSX and Linux else: - config_file = os.path.join(os.sep, 'etc', 'HouseAgent.conf') + config_dir = os.path.join(os.sep, 'etc', 'HouseAgent') + config_file = os.path.join(config_dir, 'HouseAgent.conf') if os.path.exists(config_file): - return config_file + return config_dir, config_file elif os.path.exists(os.path.join(os.getcwd(), 'HouseAgent.conf')): - return os.path.join(os.getcwd(), 'HouseAgent.conf') + return os.getcwd(), os.path.join(os.getcwd(), 'HouseAgent.conf') else: - raise ConfigFileNotFound("/etc/ or working directory.") + raise ConfigFileNotFound("/etc/HouseAgent/ or working directory.") -config_file = config_file() +config_dir, config_file = config_file() """ Template directory """ if hasattr(sys, 'frozen'): @@ -50,8 +52,8 @@ def config_file(): else: template_dir = os.path.join(os.path.dirname(__file__), 'templates') -""" Template plugin directory """ +""" Plugin directory """ if hasattr(sys, 'frozen'): - template_plugin_dir = os.path.join(os.path.dirname(sys.executable), 'plugins') + plugin_dir = os.path.join(os.path.dirname(sys.executable), 'plugins') else: - template_plugin_dir = os.path.join(os.path.dirname(__file__), 'plugins') + plugin_dir = os.path.join(os.path.dirname(__file__), 'plugins') diff --git a/houseagent/core/web.py b/houseagent/core/web.py index 99c8afd..f853370 100644 --- a/houseagent/core/web.py +++ b/houseagent/core/web.py @@ -1105,4 +1105,4 @@ def render_POST(self, request): id = request.args["id"][0] self.db.del_event(int(id)).addCallback(self.event_deleted) - return NOT_DONE_YET + return NOT_DONE_YET \ No newline at end of file diff --git a/houseagent/templates/master.html b/houseagent/templates/master.html index 11af658..3715d2c 100644 --- a/houseagent/templates/master.html +++ b/houseagent/templates/master.html @@ -30,10 +30,10 @@ main_items.append(main_item) parse_config(os.path.join(houseagent.template_dir, "menu.xml")) -for filename in os.listdir(houseagent.template_plugin_dir): +for filename in os.listdir(houseagent.plugin_dir): if not os.path.isfile(filename): - if (os.path.exists(os.path.join(houseagent.template_plugin_dir, filename, "menu.xml"))): - parse_config(os.path.join(houseagent.template_plugin_dir, filename, "menu.xml")) + if (os.path.exists(os.path.join(houseagent.plugin_dir, filename, "menu.xml"))): + parse_config(os.path.join(houseagent.plugin_dir, filename, "menu.xml")) %> @@ -125,4 +125,4 @@ - + \ No newline at end of file diff --git a/setup.py b/setup.py index 8fa0b0e..624d0a0 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,26 @@ #!/usr/bin/env python from distutils.core import setup +import ConfigParser import os version = '0.01' +def update_file(filename, search_line, replace_line): + infile = file(filename) + oldlines = infile.readlines() + infile.close + + newlines = [] + for line in oldlines: + if search_line in line: + line = replace_line + newlines.append(line) + + outfile = file(filename, 'w') + outfile.writelines(newlines) + + def find_package_files(workingdir, subdir): currentDir = os.getcwd() # Go into the working directory @@ -37,9 +53,11 @@ def find_package_files(workingdir, subdir): packages = ['houseagent','houseagent.core', 'houseagent.plugins', 'houseagent.utils', 'houseagent.pages'], package_data = {'houseagent': template_files}, scripts = ['HouseAgent.py'], - data_files = [('/etc/HouseAgent', ['HouseAgent.conf', 'specs/amqp0-8.xml']), - ('share/HouseAgent', ['houseagent.db'])], + data_files = [('/etc/HouseAgent', ['HouseAgent.conf', 'specs/amqp0-8.xml', 'houseagent.db']), ('/etc/init', ['deploy/houseagent.conf'])], ) +# For linux, specify the log and db paths +update_file('HouseAgent.conf', 'logpath=', 'logpath=/var/log/HouseAgent/') +update_file('HouseAgent.conf', 'dbpath=', 'dbpath=/etc/HouseAgent/houseagent.db') setup(**data) \ No newline at end of file