]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/spd2dec/ConvertPackage.py
2 # Convert an SPD Package class object ot a DEC Package class object by filling
3 # some fields required by DEC file.
5 # Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
6 # This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 from Common
.MigrationUtilities
import *
20 from LoadSpd
import LoadSpd
21 from StoreDec
import StoreDec
23 #The default DEC version number tool generates.
24 gDecVersion
= "0x00010005"
27 ## Add required version information.
29 # Add the default DEC specification version to Package class object.
31 # @param Package An input Package class object.
33 def AddPackageMiscVersion(Package
):
34 PackageHeader
= Package
.Header
35 PackageHeader
.DecSpecification
= gDecVersion
37 ## Add package include information.
39 # Adds the default "Include" folder to if that directory exists.
41 # @param Package An input Package class object.
43 def AddPackageInclude(Package
):
44 PackageDir
= os
.path
.dirname(Package
.Header
.FullPath
)
45 DefaultIncludeDir
= os
.path
.join(PackageDir
, "Include")
46 if os
.path
.exists(DefaultIncludeDir
):
47 Include
= IncludeClass()
48 Include
.FilePath
= "Include"
49 Package
.Includes
.insert(0, Include
)
51 ## Convert SPD Package class object to DEC Package class object.
53 # Convert SPD Package class ojbect to DEC Package class object by filling in
54 # several information required by DEC file.
56 # @param Package An input Package class object.
58 def ConvertSpdPackageToDecPackage(Package
):
59 AddPackageMiscVersion(Package
)
60 AddPackageInclude(Package
)
62 # This acts like the main() function for the script, unless it is 'import'ed
63 # into another script.
64 if __name__
== '__main__':