[llvm-commits] [LNT] r162942 - /lnt/trunk/lnt/server/config.py

Daniel Dunbar daniel at zuster.org
Thu Aug 30 14:31:39 PDT 2012


Author: ddunbar
Date: Thu Aug 30 16:31:39 2012
New Revision: 162942

URL: http://llvm.org/viewvc/llvm-project?rev=162942&view=rev
Log:
LNT: Change config objects to support normalizing relative sqlite paths.

Modified:
    lnt/trunk/lnt/server/config.py

Modified: lnt/trunk/lnt/server/config.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=162942&r1=162941&r2=162942&view=diff
==============================================================================
--- lnt/trunk/lnt/server/config.py (original)
+++ lnt/trunk/lnt/server/config.py Thu Aug 30 16:31:39 2012
@@ -38,9 +38,19 @@
     @staticmethod
     def fromData(baseDir, dict, default_email_config):
         dbPath = dict.get('path')
+
+        # If the path does not contain a database specifier, assume it is a
+        # relative path.
         if '://' not in dbPath:
             dbPath = os.path.join(baseDir, dbPath)
 
+        # If the path contains a relative SQLite specifier, make it absolute
+        # relative to the base dir.
+        if dbPath.startswith("sqlite:///") and not \
+                dbPath.startswith("sqlite:////"):
+            dbPath = "sqlite:///%s" % os.path.join(baseDir,
+                                                   dbPath[len("sqlite:///"):])
+
         # Support per-database email configurations.
         email_config = default_email_config
         if 'emailer' in dict:





More information about the llvm-commits mailing list