Add setuptools install script
Tweaked resources path discovery.
diff --git a/rest-dbus b/rest-dbus
old mode 100755
new mode 100644
index ffaa0ed..34fcb65
--- a/rest-dbus
+++ b/rest-dbus
@@ -5,6 +5,7 @@
import SocketServer
import json
import os
+import sys
from xml.etree import ElementTree
busses = {
@@ -39,7 +40,8 @@
'png': 'image/png',
'gif': 'image/gif',
}
- resource_base = 'resources'
+ resource_base = os.path.join(sys.prefix, 'share',
+ os.path.basename(__file__), 'resources')
def __init__(self, name):
(_, ext) = os.path.splitext(name)
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..ed3bf6e
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,2 @@
+[install]
+install_scripts=/usr/sbin
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..33d8567
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,9 @@
+from distutils.core import setup
+from os import listdir
+
+resources = [ 'resources/%s' %(x) for x in listdir('resources') ]
+setup(name='rest-dbus',
+ version='1.0',
+ scripts=['rest-dbus'],
+ data_files=[('rest-dbus/resources', resources)],
+ )