mirror of https://github.com/acidanthera/audk.git
BaseTools/UPT: Support Unicode path
Update the IpiDb.py to support Unicode path for localization Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
5692fa883f
commit
09e27ac559
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# This file is for installed package information database operations
|
# This file is for installed package information database operations
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
|
@ -44,7 +44,7 @@ class IpiDatabase(object):
|
||||||
Dir = os.path.dirname(DbPath)
|
Dir = os.path.dirname(DbPath)
|
||||||
if not os.path.isdir(Dir):
|
if not os.path.isdir(Dir):
|
||||||
os.mkdir(Dir)
|
os.mkdir(Dir)
|
||||||
self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')
|
self.Conn = sqlite3.connect(unicode(DbPath), isolation_level='DEFERRED')
|
||||||
self.Conn.execute("PRAGMA page_size=4096")
|
self.Conn.execute("PRAGMA page_size=4096")
|
||||||
self.Conn.execute("PRAGMA synchronous=OFF")
|
self.Conn.execute("PRAGMA synchronous=OFF")
|
||||||
self.Cur = self.Conn.cursor()
|
self.Cur = self.Conn.cursor()
|
||||||
|
@ -614,8 +614,8 @@ class IpiDatabase(object):
|
||||||
# @param DistributionFile: Distribution File
|
# @param DistributionFile: Distribution File
|
||||||
#
|
#
|
||||||
def GetDpByName(self, DistributionFile):
|
def GetDpByName(self, DistributionFile):
|
||||||
SqlCommand = """select * from %s where NewPkgFileName like '%s'""" % \
|
SqlCommand = """select * from %s where NewPkgFileName = '%s'""" % \
|
||||||
(self.DpTable, '%' + DistributionFile)
|
(self.DpTable, DistributionFile)
|
||||||
self.Cur.execute(SqlCommand)
|
self.Cur.execute(SqlCommand)
|
||||||
|
|
||||||
for Result in self.Cur:
|
for Result in self.Cur:
|
||||||
|
|
|
@ -19,8 +19,13 @@ UPT
|
||||||
|
|
||||||
## import modules
|
## import modules
|
||||||
#
|
#
|
||||||
from Core import FileHook
|
import locale
|
||||||
import sys
|
import sys
|
||||||
|
encoding = locale.getdefaultlocale()[1]
|
||||||
|
if encoding:
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding(encoding)
|
||||||
|
from Core import FileHook
|
||||||
import os.path
|
import os.path
|
||||||
from sys import platform
|
from sys import platform
|
||||||
import platform as pf
|
import platform as pf
|
||||||
|
|
Loading…
Reference in New Issue