Reorganize directory structure

Moving to directory per-application layout.  This facilitates
building single applications which is useful in the Yocto build
environment since different applications satisfy different OpenBMC
build requirements.

A number of issues are also addressed:
 - All applications were pulling in libsystemd and the gdbus libs
    irrespective of whether or not they were needed.
 - gpio.o duplicated in every application - moved to libopenbmc_intf
 - Added install target

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pyinventorymgr/Makefile b/pyinventorymgr/Makefile
new file mode 120000
index 0000000..76a90fc
--- /dev/null
+++ b/pyinventorymgr/Makefile
@@ -0,0 +1 @@
+../Makefile.python
\ No newline at end of file
diff --git a/pyinventorymgr/inventory_items.py b/pyinventorymgr/inventory_items.py
new file mode 100644
index 0000000..5e53293
--- /dev/null
+++ b/pyinventorymgr/inventory_items.py
@@ -0,0 +1,98 @@
+#!/usr/bin/python -u
+
+import os
+import sys
+import gobject
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+import cPickle
+import json
+import obmc.dbuslib.propertycacher as PropertyCacher
+from obmc.dbuslib.bindings import get_dbus, DbusProperties, DbusObjectManager
+
+if (len(sys.argv) < 2):
+	print "Usage:  inventory_items.py [system name]"
+	exit(1)
+System = __import__(sys.argv[1])
+
+
+INTF_NAME = 'org.openbmc.InventoryItem'
+DBUS_NAME = 'org.openbmc.Inventory'
+FRUS = System.FRU_INSTANCES
+
+class Inventory(DbusProperties,DbusObjectManager):
+	def __init__(self,bus,name):
+		DbusProperties.__init__(self)
+		DbusObjectManager.__init__(self)
+		dbus.service.Object.__init__(self,bus,name)
+		self.InterfacesAdded(name,self.properties)
+
+
+class InventoryItem(DbusProperties):
+	def __init__(self,bus,name,data):		
+		DbusProperties.__init__(self)
+		dbus.service.Object.__init__(self,bus,name)
+
+		self.name = name
+		
+		## this will load properties from cache
+		if (data.has_key('present') == False):
+			data['present'] = 'False'
+		if (data.has_key('fault') == False):
+			data['fault'] = 'False'
+		if (data.has_key('version') == False):
+			data['version'] = ''
+
+		self.SetMultiple(INTF_NAME,data)
+		
+		
+	@dbus.service.method(INTF_NAME,
+		in_signature='a{sv}', out_signature='')
+	def update(self,data):
+		self.SetMultiple(INTF_NAME,data)
+		PropertyCacher.save(self.name,INTF_NAME,self.properties)
+
+	@dbus.service.method(INTF_NAME,
+		in_signature='s', out_signature='')
+	def setPresent(self,present):
+		self.Set(INTF_NAME,'present',present)
+
+	@dbus.service.method(INTF_NAME,
+		in_signature='s', out_signature='')
+	def setFault(self,fault):
+		self.Set(INTF_NAME,'fault',fault)
+
+
+def getVersion():
+	version = "Error"
+	with open('/etc/os-release', 'r') as f:
+		for line in f:
+			p = line.rstrip('\n')
+			parts = line.rstrip('\n').split('=')
+			if (parts[0] == "VERSION_ID"):
+				version = parts[1]
+	return version
+
+
+if __name__ == '__main__':
+    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+    bus = get_dbus()
+    mainloop = gobject.MainLoop()
+    obj_parent = Inventory(bus, '/org/openbmc/inventory')
+
+    for f in FRUS.keys():
+	obj_path=f.replace("<inventory_root>",System.INVENTORY_ROOT)
+    	obj = InventoryItem(bus,obj_path,FRUS[f])
+	obj_parent.add(obj_path,obj)
+
+    	## TODO:  this is a hack to update bmc inventory item with version
+    	## should be done by flash object
+	if (FRUS[f]['fru_type'] == "BMC"):
+		version = getVersion()
+		obj.update({'version': version})
+
+    name = dbus.service.BusName(DBUS_NAME,bus)
+    print "Running Inventory Manager"
+    mainloop.run()
+
diff --git a/pyinventorymgr/setup.cfg b/pyinventorymgr/setup.cfg
new file mode 120000
index 0000000..29939b5
--- /dev/null
+++ b/pyinventorymgr/setup.cfg
@@ -0,0 +1 @@
+../setup.cfg
\ No newline at end of file
diff --git a/pyinventorymgr/setup.py b/pyinventorymgr/setup.py
new file mode 100644
index 0000000..851d961
--- /dev/null
+++ b/pyinventorymgr/setup.py
@@ -0,0 +1,6 @@
+from distutils.core import setup
+
+setup(name='pyinventorymgr',
+      version='1.0',
+      scripts=['inventory_items.py'],
+      )