BaseTools/Source/Python/Workspace/WorkspaceDatabase.py:
authorjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Tue, 1 Apr 2008 17:53:53 +0000 (17:53 +0000)
committerjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Tue, 1 Apr 2008 17:53:53 +0000 (17:53 +0000)
  Some fixes for the new 'Workspace' system.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1101 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Workspace/WorkspaceDatabase.py

index 58e221a..494d714 100644 (file)
@@ -16,6 +16,7 @@
 #\r
 import sqlite3\r
 import os\r
+import os.path\r
 \r
 import Common.EdkLogger as EdkLogger\r
 from CommonDataClass.DataClass import *\r
@@ -229,7 +230,10 @@ class DscBuildData(PlatformBuildClassObject):
     def _GetFdfFile(self):\r
         if self._FlashDefinition == None:\r
             RecordList = self._Table.Query(MODEL_META_DATA_HEADER, TAB_DSC_DEFINES_FLASH_DEFINITION, self.Arch)\r
-            self._FlashDefinition = NormPath(RecordList[0][0])\r
+            if len(RecordList) > 0:\r
+                self._FlashDefinition = NormPath(RecordList[0][0])\r
+            else:\r
+                self._FlashDefinition = ''\r
         return self._FlashDefinition\r
 \r
     def _GetBuildNumber(self):\r
@@ -327,7 +331,7 @@ class DscBuildData(PlatformBuildClassObject):
                     LibraryModule = self._Db.BuildObject[LibraryPath, MODEL_FILE_INF, self._Arch]\r
                     LibraryInstance[LibraryClassName] = LibraryModule\r
                     LibraryConsumerList.append(LibraryModule)\r
-                    EdkLogger.verbose("\t" + LibraryClassName + " : " + str(LibraryModule))\r
+                    EdkLogger.verbose("\t" + str(LibraryClassName) + " : " + str(LibraryModule))\r
                 else:\r
                     LibraryModule = LibraryInstance[LibraryClassName]\r
 \r
@@ -1677,6 +1681,11 @@ class WorkspaceDatabase(object):
 \r
     def __init__(self, DbPath, GlobalMacros={}):\r
         self._GlobalMacros = GlobalMacros\r
+\r
+        DbDir = os.path.split(DbPath)[0]\r
+        if not os.path.exists(DbDir):\r
+            os.makedirs(DbDir)\r
+\r
         self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')\r
         self.Conn.execute("PRAGMA synchronous=OFF")\r
         self.Conn.execute("PRAGMA temp_store=MEMORY")\r