]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/spd2dec/ConvertPackage.py
Sync EDKII BaseTools to BaseTools project r1971
[mirror_edk2.git] / BaseTools / Source / Python / spd2dec / ConvertPackage.py
1 ## @file
2 # Convert an SPD Package class object ot a DEC Package class object by filling
3 # some fields required by DEC file.
4 #
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
10 #
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.
13 #
14
15 ##
16 # Import Modules
17 #
18 import os
19 from Common.MigrationUtilities import *
20 from LoadSpd import LoadSpd
21 from StoreDec import StoreDec
22
23 #The default DEC version number tool generates.
24 gDecVersion = "0x00010005"
25
26
27 ## Add required version information.
28 #
29 # Add the default DEC specification version to Package class object.
30 #
31 # @param Package An input Package class object.
32 #
33 def AddPackageMiscVersion(Package):
34 PackageHeader = Package.Header
35 PackageHeader.DecSpecification = gDecVersion
36
37 ## Add package include information.
38 #
39 # Adds the default "Include" folder to if that directory exists.
40 #
41 # @param Package An input Package class object.
42 #
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)
50
51 ## Convert SPD Package class object to DEC Package class object.
52 #
53 # Convert SPD Package class ojbect to DEC Package class object by filling in
54 # several information required by DEC file.
55 #
56 # @param Package An input Package class object.
57 #
58 def ConvertSpdPackageToDecPackage(Package):
59 AddPackageMiscVersion(Package)
60 AddPackageInclude(Package)
61
62 # This acts like the main() function for the script, unless it is 'import'ed
63 # into another script.
64 if __name__ == '__main__':
65 pass
66