[rhmessaging-commits] rhmessaging commits: r1614 - mgmt/cumin/bin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Sun Jan 27 15:08:48 EST 2008


Author: justi9
Date: 2008-01-27 15:08:47 -0500 (Sun, 27 Jan 2008)
New Revision: 1614

Modified:
   mgmt/cumin/bin/cumin
   mgmt/cumin/bin/cumin-test
Log:
Make path handling less unix convention dependent.



Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin	2008-01-26 05:12:23 UTC (rev 1613)
+++ mgmt/cumin/bin/cumin	2008-01-27 20:08:47 UTC (rev 1614)
@@ -43,21 +43,22 @@
     if "-h" in sys.argv or "--help" in sys.argv:
         usage()
 
-    if "CUMIN_HOME" not in os.environ:
-        os.environ["CUMIN_HOME"] = "/usr/share/cumin"
+    home = os.environ.get("CUMIN_HOME")
 
+    if not home:
+        home = os.path.normpath("/usr/share/cumin")
+
     config = Config()
     config.add_param("data", "s", "postgresql://cumin@localhost/cumin")
     config.add_param("port", "i", 80)
     config.add_param("debug", "b", False)
 
-    config.load_file(os.path.expandvars("${CUMIN_HOME}/etc/cumin.conf"))
-    config.load_file(os.path.expanduser("~/.cumin.conf"))
+    config.load_file(os.path.join(home, "etc", "cumin.conf"))
+    config.load_file(os.path.join(os.path.expanduser("~"), ".cumin.conf"))
     config.load_args(sys.argv)
 
     config.show()
 
-    home = os.environ["CUMIN_HOME"]
     data = config.get("data")
     port = config.get("port")
     debug = config.get("debug")

Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test	2008-01-26 05:12:23 UTC (rev 1613)
+++ mgmt/cumin/bin/cumin-test	2008-01-27 20:08:47 UTC (rev 1614)
@@ -44,9 +44,11 @@
     if "-h" in sys.argv or "--help" in sys.argv:
         usage()
 
-    if "CUMIN_HOME" not in os.environ:
-        os.environ["CUMIN_HOME"] = "/usr/share/cumin"
+    home = os.environ.get("CUMIN_HOME")
 
+    if not home:
+        home = os.path.normpath("/usr/share/cumin")
+
     config = Config()
     config.add_param("data", "s", "postgresql://cumin@localhost/cumin")
     config.add_param("port", "i", 80)
@@ -54,8 +56,8 @@
     config.add_param("bench", "i", 1000)
     config.add_param("profile", "b", False)
 
-    config.load_file(os.path.expandvars("${CUMIN_HOME}/etc/cumin.conf"))
-    config.load_file(os.path.expanduser("~/.cumin.conf"))
+    config.load_file(os.path.join(home, "etc", "cumin.conf"))
+    config.load_file(os.path.join(os.path.expanduser("~"), ".cumin.conf"))
     config.load_args(sys.argv)
 
     config.show()




More information about the rhmessaging-commits mailing list