From 1be2ed90a20618d71ddf34b8a07d038da0b36854 Mon Sep 17 00:00:00 2001 From: Hess Chen Date: Fri, 15 Aug 2014 03:06:48 +0000 Subject: =?UTF-8?q?There=20is=20a=20limitation=20on=20WINDOWS=20OS=20for?= =?UTF-8?q?=20the=20length=20of=20entire=20file=20path=20can=E2=80=99t=20b?= =?UTF-8?q?e=20larger=20than=20255.=20There=20is=20an=20OS=20API=20provide?= =?UTF-8?q?d=20by=20Microsoft=20to=20add=20=E2=80=9C\\=3F\=E2=80=9D=20befo?= =?UTF-8?q?re=20the=20path=20header=20to=20support=20the=20long=20file=20p?= =?UTF-8?q?ath.=20Enable=20this=20feature=20on=20basetools.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen Reviewed-by: Yingke Liu git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15809 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 3 +- BaseTools/Source/Python/AutoGen/BuildEngine.py | 5 +- BaseTools/Source/Python/AutoGen/GenDepex.py | 6 +- BaseTools/Source/Python/AutoGen/GenMake.py | 5 +- BaseTools/Source/Python/AutoGen/StrGather.py | 3 +- BaseTools/Source/Python/AutoGen/UniClassObject.py | 10 +-- BaseTools/Source/Python/BPDG/BPDG.py | 4 +- BaseTools/Source/Python/BPDG/GenVpd.py | 6 +- BaseTools/Source/Python/Common/Database.py | 4 +- BaseTools/Source/Python/Common/DecClassObject.py | 5 +- BaseTools/Source/Python/Common/Dictionary.py | 3 +- BaseTools/Source/Python/Common/DscClassObject.py | 5 +- BaseTools/Source/Python/Common/EdkIIWorkspace.py | 5 +- .../Source/Python/Common/EdkIIWorkspaceBuild.py | 4 +- BaseTools/Source/Python/Common/EdkLogger.py | 4 +- BaseTools/Source/Python/Common/FdfParserLite.py | 5 +- BaseTools/Source/Python/Common/InfClassObject.py | 5 +- BaseTools/Source/Python/Common/LongFilePathOs.py | 73 ++++++++++++++++++++++ .../Source/Python/Common/LongFilePathOsPath.py | 51 +++++++++++++++ .../Source/Python/Common/LongFilePathSupport.py | 59 +++++++++++++++++ .../Source/Python/Common/MigrationUtilities.py | 5 +- BaseTools/Source/Python/Common/Misc.py | 5 +- BaseTools/Source/Python/Common/String.py | 5 +- .../Source/Python/Common/TargetTxtClassObject.py | 5 +- .../Source/Python/Common/ToolDefClassObject.py | 5 +- BaseTools/Source/Python/Common/VpdInfoFile.py | 5 +- BaseTools/Source/Python/Ecc/Check.py | 4 +- .../Source/Python/Ecc/CodeFragmentCollector.py | 4 +- BaseTools/Source/Python/Ecc/Configuration.py | 3 +- BaseTools/Source/Python/Ecc/Database.py | 4 +- BaseTools/Source/Python/Ecc/Ecc.py | 3 +- BaseTools/Source/Python/Ecc/EccGlobalData.py | 4 +- BaseTools/Source/Python/Ecc/Exception.py | 4 +- BaseTools/Source/Python/Ecc/FileProfile.py | 5 +- BaseTools/Source/Python/Ecc/MetaDataParser.py | 4 +- .../Python/Ecc/MetaFileWorkspace/MetaDataTable.py | 4 +- .../Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 5 +- BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py | 3 +- BaseTools/Source/Python/Ecc/c.py | 4 +- .../Source/Python/Eot/CodeFragmentCollector.py | 4 +- BaseTools/Source/Python/Eot/Database.py | 4 +- BaseTools/Source/Python/Eot/Eot.py | 5 +- BaseTools/Source/Python/Eot/EotGlobalData.py | 3 +- BaseTools/Source/Python/Eot/FileProfile.py | 5 +- BaseTools/Source/Python/Eot/FvImage.py | 6 +- BaseTools/Source/Python/Eot/InfParserLite.py | 4 +- BaseTools/Source/Python/Eot/Parser.py | 5 +- BaseTools/Source/Python/Eot/Report.py | 5 +- BaseTools/Source/Python/Eot/c.py | 4 +- BaseTools/Source/Python/GenFds/AprioriSection.py | 4 +- BaseTools/Source/Python/GenFds/Capsule.py | 4 +- BaseTools/Source/Python/GenFds/CompressSection.py | 2 +- BaseTools/Source/Python/GenFds/DataSection.py | 13 ++-- BaseTools/Source/Python/GenFds/DepexSection.py | 5 +- BaseTools/Source/Python/GenFds/EfiSection.py | 11 ++-- BaseTools/Source/Python/GenFds/Fd.py | 4 +- BaseTools/Source/Python/GenFds/FdfParser.py | 3 +- BaseTools/Source/Python/GenFds/FfsFileStatement.py | 4 +- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 18 +++--- BaseTools/Source/Python/GenFds/Fv.py | 9 +-- BaseTools/Source/Python/GenFds/FvImageSection.py | 4 +- BaseTools/Source/Python/GenFds/GenFds.py | 6 +- .../Source/Python/GenFds/GenFdsGlobalVariable.py | 5 +- BaseTools/Source/Python/GenFds/GuidSection.py | 5 +- .../Source/Python/GenFds/OptRomFileStatement.py | 4 +- BaseTools/Source/Python/GenFds/OptionRom.py | 5 +- BaseTools/Source/Python/GenFds/Region.py | 5 +- BaseTools/Source/Python/GenFds/Section.py | 4 +- BaseTools/Source/Python/GenFds/UiSection.py | 5 +- BaseTools/Source/Python/GenFds/VerSection.py | 5 +- BaseTools/Source/Python/GenFds/Vtf.py | 5 +- .../Python/GenPatchPcdTable/GenPatchPcdTable.py | 5 +- .../Source/Python/PatchPcdValue/PatchPcdValue.py | 5 +- BaseTools/Source/Python/Table/TableEotReport.py | 4 +- BaseTools/Source/Python/Table/TableFile.py | 4 +- BaseTools/Source/Python/Table/TableReport.py | 5 +- BaseTools/Source/Python/TargetTool/TargetTool.py | 5 +- BaseTools/Source/Python/Trim/Trim.py | 5 +- .../Source/Python/Workspace/BuildClassObject.py | 4 +- BaseTools/Source/Python/Workspace/MetaDataTable.py | 4 +- .../Source/Python/Workspace/MetaFileParser.py | 5 +- .../Source/Python/Workspace/WorkspaceDatabase.py | 3 +- BaseTools/Source/Python/build/BuildReport.py | 5 +- BaseTools/Source/Python/build/build.py | 10 +-- 84 files changed, 405 insertions(+), 180 deletions(-) create mode 100644 BaseTools/Source/Python/Common/LongFilePathOs.py create mode 100644 BaseTools/Source/Python/Common/LongFilePathOsPath.py create mode 100644 BaseTools/Source/Python/Common/LongFilePathSupport.py (limited to 'BaseTools/Source/Python') diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 11cf8b2f18..c4662572a0 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -13,7 +13,7 @@ ## Import Modules # -import os +import Common.LongFilePathOs as os import re import os.path as path import copy @@ -26,6 +26,7 @@ from StringIO import StringIO from StrGather import * from BuildEngine import BuildRule +from Common.LongFilePathSupport import CopyLongFilePath from Common.BuildToolError import * from Common.DataType import * from Common.Misc import * diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index b3083d0395..d15ccc06d5 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -1,7 +1,7 @@ ## @file # The engine for building files # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,10 +14,11 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import copy import string +from Common.LongFilePathSupport import OpenLongFilePath as open from Common.GlobalData import * from Common.BuildToolError import * diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source/Python/AutoGen/GenDepex.py index 37ba7bc72c..a390d560fc 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -1,7 +1,7 @@ ## @file # This file is used to generate DEPEX file for module's dependency expression # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -13,10 +13,10 @@ ## Import Modules # import sys -import os +import Common.LongFilePathOs as os import re import traceback - +from Common.LongFilePathSupport import OpenLongFilePath as open from StringIO import StringIO from struct import pack from Common.BuildToolError import * diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 00d0af0cb7..64eedfaa12 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1,7 +1,7 @@ ## @file # Create makefile for MS nmake and GNU make # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -13,11 +13,12 @@ ## Import Modules # -import os +import Common.LongFilePathOs as os import sys import string import re import os.path as path +from Common.LongFilePathSupport import OpenLongFilePath as open from Common.BuildToolError import * from Common.Misc import * diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/Python/AutoGen/StrGather.py index b84d9f90aa..20af015bcf 100644 --- a/BaseTools/Source/Python/AutoGen/StrGather.py +++ b/BaseTools/Source/Python/AutoGen/StrGather.py @@ -1,4 +1,4 @@ -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -20,6 +20,7 @@ from Common.BuildToolError import * from UniClassObject import * from StringIO import StringIO from struct import pack +from Common.LongFilePathSupport import OpenLongFilePath as open ## # Static definitions diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index 7b1ce72ea7..e676ad6ec8 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -1,4 +1,4 @@ -# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,13 +14,13 @@ ## # Import Modules # -import os, codecs, re +import Common.LongFilePathOs as os, codecs, re import distutils.util import Common.EdkLogger as EdkLogger from Common.BuildToolError import * from Common.String import GetLineNo from Common.Misc import PathClass - +from Common.LongFilePathSupport import LongFilePath ## # Static definitions # @@ -210,7 +210,7 @@ class UniFileClassObject(object): Lang = distutils.util.split_quoted((Line.split(u"//")[0])) if len(Lang) != 3: try: - FileIn = codecs.open(File.Path, mode='rb', encoding='utf-16').read() + FileIn = codecs.open(LongFilePath(File.Path), mode='rb', encoding='utf-16').read() except UnicodeError, X: EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File); except: @@ -292,7 +292,7 @@ class UniFileClassObject(object): EdkLogger.error("Unicode File Parser", FILE_NOT_FOUND, ExtraData=File.Path) try: - FileIn = codecs.open(File.Path, mode='rb', encoding='utf-16').readlines() + FileIn = codecs.open(LongFilePath(File.Path), mode='rb', encoding='utf-16').readlines() except UnicodeError, X: EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File.Path); except: diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python/BPDG/BPDG.py index 284eed65c7..b12403139d 100644 --- a/BaseTools/Source/Python/BPDG/BPDG.py +++ b/BaseTools/Source/Python/BPDG/BPDG.py @@ -6,7 +6,7 @@ # file of PCD layout for use during the build when the platform integrator selects to use # automatic offset calculation. # -# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -20,7 +20,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import sys import encodings.ascii diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py index 3564571787..76d30fa6ff 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -2,7 +2,7 @@ # This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe # and process each entry of vpd type PCD. # -# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -13,12 +13,12 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import os +import Common.LongFilePathOs as os import StringIO import StringTable as st import array import re - +from Common.LongFilePathSupport import OpenLongFilePath as open from struct import * import Common.EdkLogger as EdkLogger import Common.BuildToolError as BuildToolError diff --git a/BaseTools/Source/Python/Common/Database.py b/BaseTools/Source/Python/Common/Database.py index 5c0a79f291..a81a44731f 100644 --- a/BaseTools/Source/Python/Common/Database.py +++ b/BaseTools/Source/Python/Common/Database.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by ECC tool # -# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,7 @@ # Import Modules # import sqlite3 -import os +import Common.LongFilePathOs as os import EdkLogger as EdkLogger from CommonDataClass.DataClass import * diff --git a/BaseTools/Source/Python/Common/DecClassObject.py b/BaseTools/Source/Python/Common/DecClassObject.py index 5b39bcd4ce..d7c70a7336 100644 --- a/BaseTools/Source/Python/Common/DecClassObject.py +++ b/BaseTools/Source/Python/Common/DecClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of DEC file # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os from String import * from DataType import * from Identification import * @@ -26,6 +26,7 @@ from Table.TableDec import TableDec import Database from Parsing import * import GlobalData +from Common.LongFilePathSupport import OpenLongFilePath as open # # Global variable diff --git a/BaseTools/Source/Python/Common/Dictionary.py b/BaseTools/Source/Python/Common/Dictionary.py index de3556b892..5300a5456c 100644 --- a/BaseTools/Source/Python/Common/Dictionary.py +++ b/BaseTools/Source/Python/Common/Dictionary.py @@ -1,7 +1,7 @@ ## @file # Define a dictionary structure # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -16,6 +16,7 @@ # import EdkLogger from DataType import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## Convert a text file to a dictionary # diff --git a/BaseTools/Source/Python/Common/DscClassObject.py b/BaseTools/Source/Python/Common/DscClassObject.py index 3d06288e9a..788a75e267 100644 --- a/BaseTools/Source/Python/Common/DscClassObject.py +++ b/BaseTools/Source/Python/Common/DscClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of DSC file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import EdkLogger as EdkLogger import Database from String import * @@ -28,6 +28,7 @@ from BuildToolError import * from Misc import sdict import GlobalData from Table.TableDsc import TableDsc +from Common.LongFilePathSupport import OpenLongFilePath as open # # Global variable diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspace.py b/BaseTools/Source/Python/Common/EdkIIWorkspace.py index d041b35411..84d89b6c2e 100644 --- a/BaseTools/Source/Python/Common/EdkIIWorkspace.py +++ b/BaseTools/Source/Python/Common/EdkIIWorkspace.py @@ -1,7 +1,7 @@ ## @file # This is the base class for applications that operate on an EDK II Workspace # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,8 +14,9 @@ ## # Import Modules # -import os, sys, time +import Common.LongFilePathOs as os, sys, time from DataType import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## EdkIIWorkspace # diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py index 2b5990ebe7..d6df01d4ce 100644 --- a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py +++ b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of the build database # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os, string, copy, pdb, copy +import Common.LongFilePathOs as os, string, copy, pdb, copy import EdkLogger import DataType from InfClassObject import * diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source/Python/Common/EdkLogger.py index 10e7222b3d..f048b619e4 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -1,7 +1,7 @@ ## @file # This file implements the log mechanism for Python tools. # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -12,7 +12,7 @@ # ## Import modules -import sys, os, logging +import Common.LongFilePathOs as os, sys, logging import traceback from BuildToolError import * diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py index 031dc15bc7..54a60a7e8f 100644 --- a/BaseTools/Source/Python/Common/FdfParserLite.py +++ b/BaseTools/Source/Python/Common/FdfParserLite.py @@ -1,7 +1,7 @@ ## @file # parse FDF file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,9 +16,10 @@ # Import Modules # import re -import os +import Common.LongFilePathOs as os import CommonDataClass.FdfClass +from Common.LongFilePathSupport import OpenLongFilePath as open ##define T_CHAR_SPACE ' ' ##define T_CHAR_NULL '\0' diff --git a/BaseTools/Source/Python/Common/InfClassObject.py b/BaseTools/Source/Python/Common/InfClassObject.py index 7ea0c39297..f24e4e41a0 100644 --- a/BaseTools/Source/Python/Common/InfClassObject.py +++ b/BaseTools/Source/Python/Common/InfClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of INF file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import EdkLogger from CommonDataClass.CommonClass import LibraryClassClass @@ -29,6 +29,7 @@ import GlobalData from Table.TableInf import TableInf import Database from Parsing import * +from Common.LongFilePathSupport import OpenLongFilePath as open # # Global variable diff --git a/BaseTools/Source/Python/Common/LongFilePathOs.py b/BaseTools/Source/Python/Common/LongFilePathOs.py new file mode 100644 index 0000000000..66d93d25f3 --- /dev/null +++ b/BaseTools/Source/Python/Common/LongFilePathOs.py @@ -0,0 +1,73 @@ +## @file +# Override built in module os to provide support for long file path +# +# Copyright (c) 2014, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +import os +import LongFilePathOsPath +from Common.LongFilePathSupport import LongFilePath +from Common.LongFilePathSupport import UniToStr + +path = LongFilePathOsPath + +def access(path, mode): + return os.access(LongFilePath(path), mode) + +def remove(path): + return os.remove(LongFilePath(path)) + +def removedirs(name): + return os.removedirs(LongFilePath(name)) + +def rmdir(path): + return os.rmdir(LongFilePath(path)) + +def mkdir(path): + return os.mkdir(LongFilePath(path)) + +def makedirs(name, mode=0777): + return os.makedirs(LongFilePath(name), mode) + +def rename(old, new): + return os.rename(LongFilePath(old), LongFilePath(new)) + +def chdir(path): + return os.chdir(LongFilePath(path)) + +def chmod(path, mode): + return os.chmod(LongFilePath(path), mode) + +def stat(path): + return os.stat(LongFilePath(path)) + +def utime(path): + return os.utime(LongFilePath(path), None) + +def listdir(path): + List = [] + uList = os.listdir(u"%s" % LongFilePath(path)) + for Item in uList: + List.append(UniToStr(Item)) + return List + +environ = os.environ +getcwd = os.getcwd +chdir = os.chdir +walk = os.walk +W_OK = os.W_OK +F_OK = os.F_OK +sep = os.sep +linesep = os.linesep +getenv = os.getenv +pathsep = os.pathsep +name = os.name +SEEK_SET = os.SEEK_SET +SEEK_END = os.SEEK_END diff --git a/BaseTools/Source/Python/Common/LongFilePathOsPath.py b/BaseTools/Source/Python/Common/LongFilePathOsPath.py new file mode 100644 index 0000000000..cb89b1b813 --- /dev/null +++ b/BaseTools/Source/Python/Common/LongFilePathOsPath.py @@ -0,0 +1,51 @@ +## @file +# Override built in module os.path to provide support for long file path +# +# Copyright (c) 2014, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +import os +from Common.LongFilePathSupport import LongFilePath + +def isfile(path): + return os.path.isfile(LongFilePath(path)) + +def isdir(path): + return os.path.isdir(LongFilePath(path)) + +def exists(path): + return os.path.exists(LongFilePath(path)) + +def getsize(filename): + return os.path.getsize(LongFilePath(filename)) + +def getmtime(filename): + return os.path.getmtime(LongFilePath(filename)) + +def getatime(filename): + return os.path.getatime(LongFilePath(filename)) + +def getctime(filename): + return os.path.getctime(LongFilePath(filename)) + +join = os.path.join +splitext = os.path.splitext +splitdrive = os.path.splitdrive +split = os.path.split +abspath = os.path.abspath +basename = os.path.basename +commonprefix = os.path.commonprefix +sep = os.path.sep +normpath = os.path.normpath +normcase = os.path.normcase +dirname = os.path.dirname +islink = os.path.islink +isabs = os.path.isabs +realpath = os.path.realpath diff --git a/BaseTools/Source/Python/Common/LongFilePathSupport.py b/BaseTools/Source/Python/Common/LongFilePathSupport.py new file mode 100644 index 0000000000..72dde20503 --- /dev/null +++ b/BaseTools/Source/Python/Common/LongFilePathSupport.py @@ -0,0 +1,59 @@ +## @file +# Override built in function file.open to provide support for long file path +# +# Copyright (c) 2014, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +import os +import platform +import shutil + +## +# OpenLongPath +# Convert a file path to a long file path +# +def LongFilePath(FileName): + FileName = os.path.normpath(FileName) + if platform.system() == 'Windows': + if FileName.startswith('\\\\?\\'): + return FileName + if FileName.startswith('\\\\'): + return '\\\\?\\UNC\\' + FileName[2:] + if os.path.isabs(FileName): + return '\\\\?\\' + FileName + return FileName + +## +# OpenLongFilePath +# wrap open to support opening a long file path +# +def OpenLongFilePath(FileName, Mode='r', Buffer= -1): + return open(LongFilePath(FileName), Mode, Buffer) + +## +# CopyLongFilePath +# wrap copyfile to support copy a long file path +# +def CopyLongFilePath(src, dst): + with open(LongFilePath(src), 'rb') as fsrc: + with open(LongFilePath(dst), 'wb') as fdst: + shutil.copyfileobj(fsrc, fdst) + +## Convert a python unicode string to a normal string +# +# Convert a python unicode string to a normal string +# UniToStr(u'I am a string') is 'I am a string' +# +# @param Uni: The python unicode string +# +# @retval: The formatted normal string +# +def UniToStr(Uni): + return repr(Uni)[2:-1] diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseTools/Source/Python/Common/MigrationUtilities.py index 7c69704596..6d6669d7ae 100644 --- a/BaseTools/Source/Python/Common/MigrationUtilities.py +++ b/BaseTools/Source/Python/Common/MigrationUtilities.py @@ -1,7 +1,7 @@ ## @file # Contains several utilitities shared by migration tools. # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,13 +14,14 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import EdkLogger from optparse import OptionParser from Common.BuildToolError import * from XmlRoutines import * from CommonDataClass.CommonClass import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## Set all fields of CommonClass object. # diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 7b568dc3e5..e9e41de02e 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1,7 +1,7 @@ ## @file # Common routines used by all tools # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import sys import string import thread @@ -32,6 +32,7 @@ from DataType import * from BuildToolError import * from CommonDataClass.DataClass import * from Parsing import GetSplitValueList +from Common.LongFilePathSupport import OpenLongFilePath as open ## Regular expression used to find out place holders in string template gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE) diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index 04b45a0b83..4dc8e9b116 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -1,7 +1,7 @@ ## @file # This file is used to define common string related functions used in parsing process # -# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -16,13 +16,14 @@ # import re import DataType -import os.path +import Common.LongFilePathOs as os import string import EdkLogger as EdkLogger import GlobalData from BuildToolError import * from CommonDataClass.Exceptions import * +from Common.LongFilePathSupport import OpenLongFilePath as open gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE) gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$') diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py b/BaseTools/Source/Python/Common/TargetTxtClassObject.py index a7dec65a25..89e3937086 100644 --- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py +++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of Target.txt file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,11 +14,12 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import EdkLogger import DataType from BuildToolError import * import GlobalData +from Common.LongFilePathSupport import OpenLongFilePath as open gDefaultTargetTxtFile = "Conf/target.txt" diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py index 0f49457449..583d51b513 100644 --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of tools_def.txt file # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,13 +14,14 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import EdkLogger from Dictionary import * from BuildToolError import * from TargetTxtClassObject import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## # Static variables used for pattern diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index 18f6f5663c..1a68e9bee1 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -6,7 +6,7 @@ # is pointed by *_*_*_VPD_TOOL_GUID in conf/tools_def.txt # # -# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,11 +15,12 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import os +import Common.LongFilePathOs as os import re import Common.EdkLogger as EdkLogger import Common.BuildToolError as BuildToolError import subprocess +from Common.LongFilePathSupport import OpenLongFilePath as open FILE_COMMENT_TEMPLATE = \ """ diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index c1ac07e852..4e7ffe7aca 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -1,7 +1,7 @@ ## @file # This file is used to define checkpoints used by ECC tool # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -10,7 +10,7 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import os +import Common.LongFilePathOs as os import re from CommonDataClass.DataClass import * from Common.DataType import SUP_MODULE_LIST_STRING, TAB_VALUE_SPLIT diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py index 134b15f81e..171600feeb 100644 --- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py @@ -1,7 +1,7 @@ ## @file # preprocess source file # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,7 +17,7 @@ # import re -import os +import Common.LongFilePathOs as os import sys import antlr3 diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index 4f93d79661..72bfbc709b 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -14,10 +14,11 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import Common.EdkLogger as EdkLogger from Common.DataType import * from Common.String import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## Configuration # diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py index f3e2b5934a..2041175124 100644 --- a/BaseTools/Source/Python/Ecc/Database.py +++ b/BaseTools/Source/Python/Ecc/Database.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by ECC tool # -# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,7 @@ # Import Modules # import sqlite3 -import os, time +import Common.LongFilePathOs as os, time import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py index b5d733e48e..72f22d5b22 100644 --- a/BaseTools/Source/Python/Ecc/Ecc.py +++ b/BaseTools/Source/Python/Ecc/Ecc.py @@ -14,7 +14,7 @@ ## # Import Modules # -import os, time, glob, sys +import Common.LongFilePathOs as os, time, glob, sys import Common.EdkLogger as EdkLogger import Database import EccGlobalData @@ -37,6 +37,7 @@ from MetaFileWorkspace.MetaFileTable import MetaFileStorage import c import re, string from Exception import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## Ecc # diff --git a/BaseTools/Source/Python/Ecc/EccGlobalData.py b/BaseTools/Source/Python/Ecc/EccGlobalData.py index 5226e4a7d1..a20d6ead48 100644 --- a/BaseTools/Source/Python/Ecc/EccGlobalData.py +++ b/BaseTools/Source/Python/Ecc/EccGlobalData.py @@ -1,7 +1,7 @@ ## @file # This file is used to save global datas used by ECC tool # -# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os gWorkspace = '' gTarget = '' diff --git a/BaseTools/Source/Python/Ecc/Exception.py b/BaseTools/Source/Python/Ecc/Exception.py index ffbb62b3b0..fffbf30a98 100644 --- a/BaseTools/Source/Python/Ecc/Exception.py +++ b/BaseTools/Source/Python/Ecc/Exception.py @@ -1,7 +1,7 @@ ## @file # This file is used to parse exception items found by ECC tool # -# Copyright (c) 2009, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,7 @@ # Import Modules # from Xml.XmlRoutines import * -import os.path +import Common.LongFilePathOs as os # ExceptionXml to parse Exception Node of XML file class ExceptionXml(object): diff --git a/BaseTools/Source/Python/Ecc/FileProfile.py b/BaseTools/Source/Python/Ecc/FileProfile.py index 689aee0975..f31d37ff96 100644 --- a/BaseTools/Source/Python/Ecc/FileProfile.py +++ b/BaseTools/Source/Python/Ecc/FileProfile.py @@ -1,7 +1,7 @@ ## @file # fragments of source file # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,8 +17,9 @@ # import re -import os +import Common.LongFilePathOs as os from ParserWarning import Warning +from Common.LongFilePathSupport import OpenLongFilePath as open CommentList = [] PPDirectiveList = [] diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py index bbafa00ddd..98b16a0e5c 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -1,7 +1,7 @@ ## @file # This file is used to define common parser functions for meta-data # -# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import os +import Common.LongFilePathOs as os from CommonDataClass.DataClass import * from EccToolError import * import EccGlobalData diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py index 643c228665..0d53f05d8b 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase table for files # -# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import Common.EdkLogger as EdkLogger from CommonDataClass import DataClass diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 405c5b5b03..949d067945 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import time import copy @@ -31,7 +31,8 @@ from Common.Expression import * from CommonDataClass.Exceptions import * from MetaFileTable import MetaFileStorage -from GenFds.FdfParser import FdfParser +from GenFds.FdfParser import FdfParser +from Common.LongFilePathSupport import OpenLongFilePath as open ## A decorator used to parse macro definition def ParseMacro(Parser): diff --git a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py index 5823067056..b93588eea6 100644 --- a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py +++ b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py @@ -2,7 +2,7 @@ # This is an XML API that uses a syntax similar to XPath, but it is written in # standard python so that no extra python packages are required to use it. # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -16,6 +16,7 @@ # Import Modules # import xml.dom.minidom +from Common.LongFilePathSupport import OpenLongFilePath as open ## Create a element of XML # diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index ea7d99fecd..6c20f6c9a3 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -1,7 +1,7 @@ ## @file # This file is used to be the c coding style checking of ECC tool # -# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -12,7 +12,7 @@ # import sys -import os +import Common.LongFilePathOs as os import re import string import CodeFragmentCollector diff --git a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py index 4e8cef2c42..bb78a0f882 100644 --- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py +++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py @@ -1,7 +1,7 @@ ## @file # preprocess source file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,7 +16,7 @@ # Import Modules # import re -import os +import Common.LongFilePathOs as os import sys import antlr3 diff --git a/BaseTools/Source/Python/Eot/Database.py b/BaseTools/Source/Python/Eot/Database.py index ce38a0fa92..65bac9c127 100644 --- a/BaseTools/Source/Python/Eot/Database.py +++ b/BaseTools/Source/Python/Eot/Database.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by EOT tool # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,7 @@ # Import Modules # import sqlite3 -import os, time +import Common.LongFilePathOs as os, time import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/Eot/Eot.py index 029caedabc..5029f7369d 100644 --- a/BaseTools/Source/Python/Eot/Eot.py +++ b/BaseTools/Source/Python/Eot/Eot.py @@ -1,7 +1,7 @@ ## @file # This file is used to be the main entrance of EOT tool # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os, time, glob +import Common.LongFilePathOs as os, time, glob import Common.EdkLogger as EdkLogger import EotGlobalData from optparse import OptionParser @@ -30,6 +30,7 @@ from Report import Report from Common.Misc import ParseConsoleLog from Common.BuildVersion import gBUILD_VERSION from Parser import ConvertGuid +from Common.LongFilePathSupport import OpenLongFilePath as open ## Class Eot # diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py b/BaseTools/Source/Python/Eot/EotGlobalData.py index 43fd57a8de..dd4ff4cf5e 100644 --- a/BaseTools/Source/Python/Eot/EotGlobalData.py +++ b/BaseTools/Source/Python/Eot/EotGlobalData.py @@ -1,7 +1,7 @@ ## @file # This file is used to save global datas # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -12,6 +12,7 @@ # from Common.Misc import sdict +from Common.LongFilePathSupport import OpenLongFilePath as open gEFI_SOURCE = '' gEDK_SOURCE = '' diff --git a/BaseTools/Source/Python/Eot/FileProfile.py b/BaseTools/Source/Python/Eot/FileProfile.py index b377ef6f41..0544c0d55b 100644 --- a/BaseTools/Source/Python/Eot/FileProfile.py +++ b/BaseTools/Source/Python/Eot/FileProfile.py @@ -1,7 +1,7 @@ ## @file # fragments of source file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,8 +17,9 @@ # import re -import os +import Common.LongFilePathOs as os from ParserWarning import Warning +from Common.LongFilePathSupport import OpenLongFilePath as open # Profile contents of a file PPDirectiveList = [] diff --git a/BaseTools/Source/Python/Eot/FvImage.py b/BaseTools/Source/Python/Eot/FvImage.py index f668a17c09..f2a9bc6801 100644 --- a/BaseTools/Source/Python/Eot/FvImage.py +++ b/BaseTools/Source/Python/Eot/FvImage.py @@ -1,7 +1,7 @@ ## @file # Parse FV image # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -13,7 +13,7 @@ ## Import Modules # -import os +import Common.LongFilePathOs as os import re import sys import uuid @@ -24,7 +24,7 @@ import copy from UserDict import IterableUserDict from cStringIO import StringIO from array import array - +from Common.LongFilePathSupport import OpenLongFilePath as open from CommonDataClass import * from Common.Misc import sdict, GuidStructureStringToGuidString diff --git a/BaseTools/Source/Python/Eot/InfParserLite.py b/BaseTools/Source/Python/Eot/InfParserLite.py index 6750f5a0c9..6bb2c5f9f1 100644 --- a/BaseTools/Source/Python/Eot/InfParserLite.py +++ b/BaseTools/Source/Python/Eot/InfParserLite.py @@ -1,7 +1,7 @@ ## @file # This file is used to parse INF file of EDK project # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import Common.EdkLogger as EdkLogger from Common.DataType import * from CommonDataClass.DataClass import * diff --git a/BaseTools/Source/Python/Eot/Parser.py b/BaseTools/Source/Python/Eot/Parser.py index d5419d0e06..ab19e30b69 100644 --- a/BaseTools/Source/Python/Eot/Parser.py +++ b/BaseTools/Source/Python/Eot/Parser.py @@ -2,7 +2,7 @@ # This file is used to define common parsing related functions used in parsing # Inf/Dsc/Makefile process # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,7 @@ ## # Import Modules # -import os, re +import Common.LongFilePathOs as os, re import Common.EdkLogger as EdkLogger from Common.DataType import * from CommonDataClass.DataClass import * @@ -23,6 +23,7 @@ from Common.String import CleanString, GetSplitValueList, ReplaceMacro import EotGlobalData from Common.Misc import sdict from Common.String import GetSplitList +from Common.LongFilePathSupport import OpenLongFilePath as open ## PreProcess() method # diff --git a/BaseTools/Source/Python/Eot/Report.py b/BaseTools/Source/Python/Eot/Report.py index 024f6d87be..386e3eb8ec 100644 --- a/BaseTools/Source/Python/Eot/Report.py +++ b/BaseTools/Source/Python/Eot/Report.py @@ -1,7 +1,7 @@ ## @file # This file is used to create report for Eot tool # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,8 +14,9 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import EotGlobalData +from Common.LongFilePathSupport import OpenLongFilePath as open ## Report() class # diff --git a/BaseTools/Source/Python/Eot/c.py b/BaseTools/Source/Python/Eot/c.py index 02ff959958..8199ce5ee7 100644 --- a/BaseTools/Source/Python/Eot/c.py +++ b/BaseTools/Source/Python/Eot/c.py @@ -1,7 +1,7 @@ ## @file # preprocess source file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,7 +16,7 @@ # Import Modules # import sys -import os +import Common.LongFilePathOs as os import re import CodeFragmentCollector import FileProfile diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseTools/Source/Python/GenFds/AprioriSection.py index a6dace82a6..a2306d062d 100644 --- a/BaseTools/Source/Python/GenFds/AprioriSection.py +++ b/BaseTools/Source/Python/GenFds/AprioriSection.py @@ -1,7 +1,7 @@ ## @file # process APRIORI file data and generate PEI/DXE APRIORI file # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,7 +16,7 @@ # Import Modules # from struct import * -import os +import Common.LongFilePathOs as os import StringIO import FfsFileStatement from GenFdsGlobalVariable import GenFdsGlobalVariable diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py index fb9213b467..85f95a69c1 100644 --- a/BaseTools/Source/Python/GenFds/Capsule.py +++ b/BaseTools/Source/Python/GenFds/Capsule.py @@ -1,7 +1,7 @@ ## @file # generate capsule # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,7 +17,7 @@ # from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import CapsuleClassObject -import os +import Common.LongFilePathOs as os import subprocess import StringIO from Common.Misc import SaveFileOnChange diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py index 4bcf286c23..9d9c9cfdf7 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -1,7 +1,7 @@ ## @file # process compress section generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py index 0f41953ad4..ba3677ed89 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -1,7 +1,7 @@ ## @file # process data section generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -19,10 +19,10 @@ import Section from GenFdsGlobalVariable import GenFdsGlobalVariable import subprocess from Ffs import Ffs -import os +import Common.LongFilePathOs as os from CommonDataClass.FdfClass import DataSectionClassObject from Common.Misc import PeImageClass -import shutil +from Common.LongFilePathSupport import CopyLongFilePath ## generate data section # @@ -71,9 +71,8 @@ class DataSection (DataSectionClassObject): MapFile = Filename.replace('.efi', '.map') if os.path.exists(MapFile): CopyMapFile = os.path.join(OutputPath, ModuleName + '.map') - if not os.path.exists(CopyMapFile) or \ - (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)): - shutil.copyfile(MapFile, CopyMapFile) + if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)): + CopyLongFilePath(MapFile, CopyMapFile) #Get PE Section alignment when align is set to AUTO if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'): @@ -92,7 +91,7 @@ class DataSection (DataSectionClassObject): FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi') if not os.path.exists(FileBeforeStrip) or \ (os.path.getmtime(self.SectFileName) > os.path.getmtime(FileBeforeStrip)): - shutil.copyfile(self.SectFileName, FileBeforeStrip) + CopyLongFilePath(self.SectFileName, FileBeforeStrip) StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped') GenFdsGlobalVariable.GenerateFirmwareImage( StrippedFile, diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py index b7b1ae7d93..c048efe478 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -1,7 +1,7 @@ ## @file # process depex section generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -19,10 +19,9 @@ import Section from GenFdsGlobalVariable import GenFdsGlobalVariable import subprocess from Ffs import Ffs -import os +import Common.LongFilePathOs as os from CommonDataClass.FdfClass import DepexSectionClassObject from AutoGen.GenDepex import DependencyExpression -import shutil from Common import EdkLogger from Common.BuildToolError import * diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py index 3eb4e23842..15ebac5705 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -20,12 +20,13 @@ import Section from GenFdsGlobalVariable import GenFdsGlobalVariable import subprocess from Ffs import Ffs -import os +import Common.LongFilePathOs as os from CommonDataClass.FdfClass import EfiSectionClassObject -import shutil from Common import EdkLogger from Common.BuildToolError import * from Common.Misc import PeImageClass +from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.LongFilePathSupport import CopyLongFilePath ## generate rule section # @@ -237,14 +238,14 @@ class EfiSection (EfiSectionClassObject): if os.path.exists(MapFile): CopyMapFile = os.path.join(OutputPath, ModuleName + '.map') if not os.path.exists(CopyMapFile) or \ - (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)): - shutil.copyfile(MapFile, CopyMapFile) + (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)): + CopyLongFilePath(MapFile, CopyMapFile) if not NoStrip: FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi') if not os.path.exists(FileBeforeStrip) or \ (os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)): - shutil.copyfile(File, FileBeforeStrip) + CopyLongFilePath(File, FileBeforeStrip) StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped') GenFdsGlobalVariable.GenerateFirmwareImage( StrippedFile, diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py index 3716549cba..0c06ff57dc 100644 --- a/BaseTools/Source/Python/GenFds/Fd.py +++ b/BaseTools/Source/Python/GenFds/Fd.py @@ -1,7 +1,7 @@ ## @file # process FD generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,7 +17,7 @@ # import Region import Fv -import os +import Common.LongFilePathOs as os import StringIO import sys from struct import * diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index f1e03f4c3f..01dab7bdab 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -55,7 +55,8 @@ from Common.String import ReplaceMacro from Common.Misc import tdict import re -import os +import Common.LongFilePathOs as os +from Common.LongFilePathSupport import OpenLongFilePath as open ##define T_CHAR_SPACE ' ' ##define T_CHAR_NULL '\0' diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py index d0dec380fb..a765f9e04a 100644 --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py @@ -1,7 +1,7 @@ ## @file # process FFS generation from FILE statement # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,7 +17,7 @@ # import Ffs import Rule -import os +import Common.LongFilePathOs as os import StringIO import subprocess diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index feab8c84a0..a7a65919d7 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -1,7 +1,7 @@ ## @file # process FFS generation from INF statement # -# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,8 +16,7 @@ # Import Modules # import Rule -import os -import shutil +import Common.LongFilePathOs as os import StringIO from struct import * from GenFdsGlobalVariable import GenFdsGlobalVariable @@ -38,6 +37,8 @@ from FvImageSection import FvImageSection from Common.Misc import PeImageClass from AutoGen.GenDepex import DependencyExpression from PatchPcdValue.PatchPcdValue import PatchBinaryFile +from Common.LongFilePathSupport import CopyLongFilePath +from Common.LongFilePathSupport import OpenLongFilePath as open ## generate FFS from INF # @@ -322,7 +323,7 @@ class FfsInfStatement(FfsInfStatementClassObject): return EfiFile Basename = os.path.basename(EfiFile) Output = os.path.join(self.OutputPath, Basename) - shutil.copy(EfiFile, Output) + CopyLongFilePath(EfiFile, Output) for Pcd in self.PatchPcds: RetVal, RetStr = PatchBinaryFile(Output, int(Pcd.Offset, 0), Pcd.DatumType, Pcd.DefaultValue, Pcd.MaxDatumSize) if RetVal: @@ -648,8 +649,8 @@ class FfsInfStatement(FfsInfStatementClassObject): if not NoStrip: FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc') if not os.path.exists(FileBeforeStrip) or \ - (os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)): - shutil.copyfile(File, FileBeforeStrip) + (os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)): + CopyLongFilePath(File, FileBeforeStrip) StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped') GenFdsGlobalVariable.GenerateFirmwareImage( StrippedFile, @@ -687,8 +688,9 @@ class FfsInfStatement(FfsInfStatementClassObject): if not NoStrip: FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc') if not os.path.exists(FileBeforeStrip) or \ - (os.path.getmtime(GenSecInputFile) > os.path.getmtime(FileBeforeStrip)): - shutil.copyfile(GenSecInputFile, FileBeforeStrip) + (os.path.getmtime(GenSecInputFile) > os.path.getmtime(FileBeforeStrip)): + CopyLongFilePath(GenSecInputFile, FileBeforeStrip) + StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped') GenFdsGlobalVariable.GenerateFirmwareImage( StrippedFile, diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 781c1a045d..03a742696f 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -1,7 +1,7 @@ ## @file # process FV generation # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,8 +15,7 @@ ## # Import Modules # -import os -import shutil +import Common.LongFilePathOs as os import subprocess import StringIO from struct import * @@ -27,6 +26,8 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable from GenFds import GenFds from CommonDataClass.FdfClass import FvClassObject from Common.Misc import SaveFileOnChange +from Common.LongFilePathSupport import CopyLongFilePath +from Common.LongFilePathSupport import OpenLongFilePath as open T_CHAR_LF = '\n' @@ -128,7 +129,7 @@ class FV (FvClassObject): FvOutputFile = self.CreateFileName FvInfoFileName = os.path.join(GenFdsGlobalVariable.FfsDir, self.UiFvName + '.inf') - shutil.copy(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName) + CopyLongFilePath(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName) OrigFvInfo = None if os.path.exists (FvInfoFileName): OrigFvInfo = open(FvInfoFileName, 'r').read() diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py index f5d3f4f9a5..caf8de11e5 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -1,7 +1,7 @@ ## @file # process FV image section generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -20,7 +20,7 @@ import StringIO from Ffs import Ffs import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable -import os +import Common.LongFilePathOs as os from CommonDataClass.FdfClass import FvImageSectionClassObject from Common import EdkLogger from Common.BuildToolError import * diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index c0762edf22..087f7ab356 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -1,7 +1,7 @@ ## @file # generate flash image # -# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,7 +17,7 @@ # from optparse import OptionParser import sys -import os +import Common.LongFilePathOs as os import linecache import FdfParser import Common.BuildToolError as BuildToolError @@ -42,7 +42,7 @@ from Common.BuildVersion import gBUILD_VERSION ## Version and Copyright versionNumber = "1.0" + ' ' + gBUILD_VERSION __version__ = "%prog Version " + versionNumber -__copyright__ = "Copyright (c) 2007 - 2013, Intel Corporation All rights reserved." +__copyright__ = "Copyright (c) 2007 - 2014, Intel Corporation All rights reserved." ## Tool entrance method # diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index cbf3d980a8..f97b41b834 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -1,7 +1,7 @@ ## @file # Global variables for GenFds # -# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,7 +15,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import sys import subprocess import struct @@ -30,6 +30,7 @@ from Common.ToolDefClassObject import ToolDefClassObject from AutoGen.BuildEngine import BuildRule import Common.DataType as DataType from Common.Misc import PathClass +from Common.LongFilePathSupport import OpenLongFilePath as open ## Global variables # diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py index 36ad4f58ef..97d8ba8f76 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -1,7 +1,7 @@ ## @file # process GUIDed section generation # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -18,7 +18,7 @@ import Section import subprocess from Ffs import Ffs -import os +import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import GuidSectionClassObject from Common import ToolDefClassObject @@ -26,6 +26,7 @@ import sys from Common import EdkLogger from Common.BuildToolError import * from FvImageSection import FvImageSection +from Common.LongFilePathSupport import OpenLongFilePath as open ## generate GUIDed section # diff --git a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py b/BaseTools/Source/Python/GenFds/OptRomFileStatement.py index a98d208e1d..5e3273d0f8 100644 --- a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomFileStatement.py @@ -1,7 +1,7 @@ ## @file # process OptionROM generation from FILE statement # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,7 +15,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable ## diff --git a/BaseTools/Source/Python/GenFds/OptionRom.py b/BaseTools/Source/Python/GenFds/OptionRom.py index ce46413bf6..94f77f60e8 100644 --- a/BaseTools/Source/Python/GenFds/OptionRom.py +++ b/BaseTools/Source/Python/GenFds/OptionRom.py @@ -1,7 +1,7 @@ ## @file # process OptionROM generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,8 +15,7 @@ ## # Import Modules # -import os -import shutil +import Common.LongFilePathOs as os import subprocess import StringIO diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py index 7879a9e29c..15b2ecba90 100644 --- a/BaseTools/Source/Python/GenFds/Region.py +++ b/BaseTools/Source/Python/GenFds/Region.py @@ -1,7 +1,7 @@ ## @file # process FD Region generation # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -19,10 +19,11 @@ from struct import * from GenFdsGlobalVariable import GenFdsGlobalVariable import StringIO from CommonDataClass.FdfClass import RegionClassObject -import os +import Common.LongFilePathOs as os from stat import * from Common import EdkLogger from Common.BuildToolError import * +from Common.LongFilePathSupport import OpenLongFilePath as open ## generate Region # diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py index 819bb51a78..e32041d6a5 100644 --- a/BaseTools/Source/Python/GenFds/Section.py +++ b/BaseTools/Source/Python/GenFds/Section.py @@ -1,7 +1,7 @@ ## @file # section base class # -# Copyright (c) 2007-2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2007-2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,7 +17,7 @@ # from CommonDataClass.FdfClass import SectionClassObject from GenFdsGlobalVariable import GenFdsGlobalVariable -import os, glob +import Common.LongFilePathOs as os, glob from Common import EdkLogger from Common.BuildToolError import * diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py index e1b69ed133..e4f3647f13 100644 --- a/BaseTools/Source/Python/GenFds/UiSection.py +++ b/BaseTools/Source/Python/GenFds/UiSection.py @@ -1,7 +1,7 @@ ## @file # process UI section generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -18,9 +18,10 @@ import Section from Ffs import Ffs import subprocess -import os +import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import UiSectionClassObject +from Common.LongFilePathSupport import OpenLongFilePath as open ## generate UI section # diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py index 8f6da9624f..657ebd9d16 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -1,7 +1,7 @@ ## @file # process Version section generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -17,10 +17,11 @@ # from Ffs import Ffs import Section -import os +import Common.LongFilePathOs as os import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import VerSectionClassObject +from Common.LongFilePathSupport import OpenLongFilePath as open ## generate version section # diff --git a/BaseTools/Source/Python/GenFds/Vtf.py b/BaseTools/Source/Python/GenFds/Vtf.py index e7e36491db..64b5d77138 100644 --- a/BaseTools/Source/Python/GenFds/Vtf.py +++ b/BaseTools/Source/Python/GenFds/Vtf.py @@ -1,7 +1,7 @@ ## @file # process VTF generation # -# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,8 +16,9 @@ # Import Modules # from GenFdsGlobalVariable import GenFdsGlobalVariable -import os +import Common.LongFilePathOs as os from CommonDataClass.FdfClass import VtfClassObject +from Common.LongFilePathSupport import OpenLongFilePath as open T_CHAR_LF = '\n' ## generate VTF diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py index 9cfdad3171..50d99f7267 100644 --- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py +++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py @@ -5,7 +5,7 @@ # PCD Name Offset in binary # ======== ================ # -# Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -18,7 +18,7 @@ #====================================== External Libraries ======================================== import optparse -import os +import Common.LongFilePathOs as os import re import array @@ -26,6 +26,7 @@ from Common.BuildToolError import * import Common.EdkLogger as EdkLogger from Common.Misc import PeImageClass from Common.BuildVersion import gBUILD_VERSION +from Common.LongFilePathSupport import OpenLongFilePath as open # Version and Copyright __version_number__ = ("0.10" + " " + gBUILD_VERSION) diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py index 01b87012cd..1b3a0ec93d 100644 --- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py +++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py @@ -1,7 +1,7 @@ ## @file # Patch value into the binary file. # -# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,8 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os +from Common.LongFilePathSupport import OpenLongFilePath as open import sys import re diff --git a/BaseTools/Source/Python/Table/TableEotReport.py b/BaseTools/Source/Python/Table/TableEotReport.py index dd465b68b2..740105c8f9 100644 --- a/BaseTools/Source/Python/Table/TableEotReport.py +++ b/BaseTools/Source/Python/Table/TableEotReport.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase table for ECC reports # -# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,7 @@ # Import Modules # import Common.EdkLogger as EdkLogger -import os, time +import Common.LongFilePathOs as os, time from Table import Table from Common.String import ConvertToSqlString2 import Eot.EotToolError as EotToolError diff --git a/BaseTools/Source/Python/Table/TableFile.py b/BaseTools/Source/Python/Table/TableFile.py index e43802ef25..caf749e9d3 100644 --- a/BaseTools/Source/Python/Table/TableFile.py +++ b/BaseTools/Source/Python/Table/TableFile.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase table for files # -# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -17,7 +17,7 @@ import Common.EdkLogger as EdkLogger from Table import Table from Common.String import ConvertToSqlString -import os +import Common.LongFilePathOs as os from CommonDataClass.DataClass import FileClass ## TableFile diff --git a/BaseTools/Source/Python/Table/TableReport.py b/BaseTools/Source/Python/Table/TableReport.py index 2e7fd539f7..4065a43c5b 100644 --- a/BaseTools/Source/Python/Table/TableReport.py +++ b/BaseTools/Source/Python/Table/TableReport.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase table for ECC reports # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -15,11 +15,12 @@ # Import Modules # import Common.EdkLogger as EdkLogger -import os, time +import Common.LongFilePathOs as os, time from Table import Table from Common.String import ConvertToSqlString2 import EccToolError as EccToolError import EccGlobalData as EccGlobalData +from Common.LongFilePathSupport import OpenLongFilePath as open ## TableReport # diff --git a/BaseTools/Source/Python/TargetTool/TargetTool.py b/BaseTools/Source/Python/TargetTool/TargetTool.py index 8126aac59c..7a366db5fb 100644 --- a/BaseTools/Source/Python/TargetTool/TargetTool.py +++ b/BaseTools/Source/Python/TargetTool/TargetTool.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -10,7 +10,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import os +import Common.LongFilePathOs as os import sys import traceback from optparse import OptionParser @@ -19,6 +19,7 @@ import Common.EdkLogger as EdkLogger import Common.BuildToolError as BuildToolError from Common.DataType import * from Common.BuildVersion import gBUILD_VERSION +from Common.LongFilePathSupport import OpenLongFilePath as open # To Do 1.set clean, 2. add item, if the line is disabled. diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index c0ede03359..13485c72da 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -1,7 +1,7 @@ ## @file # Trim files preprocessed by compiler # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import sys import re @@ -24,6 +24,7 @@ from Common.BuildToolError import * from Common.Misc import * from Common.BuildVersion import gBUILD_VERSION import Common.EdkLogger as EdkLogger +from Common.LongFilePathSupport import OpenLongFilePath as open # Version and Copyright __version_number__ = ("0.10" + " " + gBUILD_VERSION) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 7d709d3f0b..a95e3f39ab 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of the build database # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import os +import Common.LongFilePathOs as os from Common.Misc import sdict from Common.Misc import RealPath2 diff --git a/BaseTools/Source/Python/Workspace/MetaDataTable.py b/BaseTools/Source/Python/Workspace/MetaDataTable.py index 34ef4903df..ee4ba6869f 100644 --- a/BaseTools/Source/Python/Workspace/MetaDataTable.py +++ b/BaseTools/Source/Python/Workspace/MetaDataTable.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase table for files # -# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import Common.EdkLogger as EdkLogger from CommonDataClass import DataClass diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index bc45a66e49..7e6e2db40d 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1,7 +1,7 @@ ## @file # This file is used to parse meta files # -# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import time import copy @@ -28,6 +28,7 @@ from Common.String import * from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd from Common.Expression import * from CommonDataClass.Exceptions import * +from Common.LongFilePathSupport import OpenLongFilePath as open from MetaFileTable import MetaFileStorage diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 6ebb7ee87d..b4109155a6 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -15,8 +15,7 @@ # Import Modules # import sqlite3 -import os -import os.path +import Common.LongFilePathOs as os import pickle import uuid diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 945ee1b573..327d5a5347 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -4,7 +4,7 @@ # This module contains the functionality to generate build report after # build all target completes successfully. # -# Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -16,7 +16,7 @@ ## Import Modules # -import os +import Common.LongFilePathOs as os import re import platform import textwrap @@ -40,6 +40,7 @@ from Common.DataType import TAB_SPACE_SPLIT from Common.DataType import TAB_BRG_PCD from Common.DataType import TAB_BRG_LIBRARY from Common.DataType import TAB_BACK_SLASH +from Common.LongFilePathSupport import OpenLongFilePath as open ## Pattern to extract contents in EDK DXS files gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index fca36d1807..bd43f2cff1 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1,7 +1,7 @@ ## @file # build a platform or a module # -# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,7 +15,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import StringIO import sys @@ -31,6 +31,8 @@ from optparse import OptionParser from subprocess import * from Common import Misc as Utils +from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.LongFilePathSupport import LongFilePath from Common.TargetTxtClassObject import * from Common.ToolDefClassObject import * from Common.DataType import * @@ -49,7 +51,7 @@ import Common.GlobalData as GlobalData # Version and Copyright VersionNumber = "0.51" + ' ' + gBUILD_VERSION __version__ = "%prog Version " + VersionNumber -__copyright__ = "Copyright (c) 2007 - 2013, Intel Corporation All rights reserved." +__copyright__ = "Copyright (c) 2007 - 2014, Intel Corporation All rights reserved." ## standard targets of build command gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run'] @@ -1028,7 +1030,7 @@ class Build(): FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map') if not os.path.exists(FvMapBuffer): continue - FvMap = open (FvMapBuffer, 'r') + FvMap = open(FvMapBuffer, 'r') #skip FV size information FvMap.readline() FvMap.readline() -- cgit v1.2.3