\r
return True\r
\r
-## Make a Python object persistent on file system\r
-#\r
-# @param Data The object to be stored in file\r
-# @param File The path of file to store the object\r
-#\r
-def DataDump(Data, File):\r
- Fd = None\r
- try:\r
- Fd = open(File, 'wb')\r
- pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)\r
- except:\r
- EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)\r
- finally:\r
- if Fd is not None:\r
- Fd.close()\r
-\r
-## Restore a Python object from a file\r
-#\r
-# @param File The path of file stored the object\r
-#\r
-# @retval object A python object\r
-# @retval None If failure in file operation\r
-#\r
-def DataRestore(File):\r
- Data = None\r
- Fd = None\r
- try:\r
- Fd = open(File, 'rb')\r
- Data = pickle.load(Fd)\r
- except Exception as e:\r
- EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))\r
- Data = None\r
- finally:\r
- if Fd is not None:\r
- Fd.close()\r
- return Data\r
-\r
## Retrieve and cache the real path name in file system\r
#\r
# @param Root The root directory of path relative to\r
\r
from struct import *\r
from threading import *\r
+import threading\r
from optparse import OptionParser\r
from subprocess import *\r
from Common import Misc as Utils\r
TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')\r
TmpTableDict = {}\r
\r
+## Make a Python object persistent on file system\r
+#\r
+# @param Data The object to be stored in file\r
+# @param File The path of file to store the object\r
+#\r
+def _DataDump(Data, File):\r
+ Fd = None\r
+ try:\r
+ Fd = open(File, 'wb')\r
+ pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)\r
+ except:\r
+ EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)\r
+ finally:\r
+ if Fd is not None:\r
+ Fd.close()\r
+\r
+## Restore a Python object from a file\r
+#\r
+# @param File The path of file stored the object\r
+#\r
+# @retval object A python object\r
+# @retval None If failure in file operation\r
+#\r
+def _DataRestore(File):\r
+ Data = None\r
+ Fd = None\r
+ try:\r
+ Fd = open(File, 'rb')\r
+ Data = pickle.load(Fd)\r
+ except Exception as e:\r
+ EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))\r
+ Data = None\r
+ finally:\r
+ if Fd is not None:\r
+ Fd.close()\r
+ return Data\r
+\r
## Check environment PATH variable to make sure the specified tool is found\r
#\r
# If the tool is found in the PATH, then True is returned\r
def DumpBuildData(self):\r
CacheDirectory = os.path.dirname(GlobalData.gDatabasePath)\r
Utils.CreateDirectory(CacheDirectory)\r
- Utils.DataDump(Utils.gFileTimeStampCache, os.path.join(CacheDirectory, "gFileTimeStampCache"))\r
- Utils.DataDump(Utils.gDependencyDatabase, os.path.join(CacheDirectory, "gDependencyDatabase"))\r
+ Utils._DataDump(Utils.gFileTimeStampCache, os.path.join(CacheDirectory, "gFileTimeStampCache"))\r
+ Utils._DataDump(Utils.gDependencyDatabase, os.path.join(CacheDirectory, "gDependencyDatabase"))\r
\r
def RestoreBuildData(self):\r
FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), "gFileTimeStampCache")\r
if Utils.gFileTimeStampCache == {} and os.path.isfile(FilePath):\r
- Utils.gFileTimeStampCache = Utils.DataRestore(FilePath)\r
+ Utils.gFileTimeStampCache = Utils._DataRestore(FilePath)\r
if Utils.gFileTimeStampCache is None:\r
Utils.gFileTimeStampCache = {}\r
\r
FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), "gDependencyDatabase")\r
if Utils.gDependencyDatabase == {} and os.path.isfile(FilePath):\r
- Utils.gDependencyDatabase = Utils.DataRestore(FilePath)\r
+ Utils.gDependencyDatabase = Utils._DataRestore(FilePath)\r
if Utils.gDependencyDatabase is None:\r
Utils.gDependencyDatabase = {}\r
\r