[PATCH rest-dbus 2/3] Add setuptools install script
OpenBMC Patches
patches at stwcx.xyz
Fri Oct 30 04:39:36 AEDT 2015
From: Brad Bishop <bradleyb at us.ibm.com>
Tweaked resources path discovery.
---
rest-dbus | 4 +++-
setup.cfg | 2 ++
setup.py | 9 +++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
mode change 100755 => 100644 rest-dbus
create mode 100644 setup.cfg
create mode 100644 setup.py
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 BaseHTTPServer
import SocketServer
import json
import os
+import sys
from xml.etree import ElementTree
busses = {
@@ -39,7 +40,8 @@ class DBusRestResourceResponse(DBusRestResponse):
'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)],
+ )
--
2.6.0
More information about the openbmc
mailing list