1## @file
2# This file is used to define a class object to describe a package
3#
4# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
5# This program and the accompanying materials
6# are licensed and made available under the terms and conditions of the BSD License
7# which accompanies this distribution.    The full text of the license may be found at
8# http://opensource.org/licenses/bsd-license.php
9#
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13##
14# Import Modules
15#
16from CommonClass import *
17from Common.Misc import sdict
18
19## PackageHeaderClass
20#
21# This class defined header items used in Package file
22#
23# @param IdentificationClass:  Inherited from IdentificationClass class
24# @param CommonHeaderClass:    Inherited from CommonHeaderClass class
25#
26# @var DecSpecification:       To store value for DecSpecification
27# @var ReadOnly:               To store value for ReadOnly
28# @var RePackage:              To store value for RePackage
29# @var ClonedFrom:             To store value for ClonedFrom, it is a set structure as
30#                              [ ClonedRecordClass, ...]
31#
32class PackageHeaderClass(IdentificationClass, CommonHeaderClass):
33    def __init__(self):
34        IdentificationClass.__init__(self)
35        CommonHeaderClass.__init__(self)
36        self.DecSpecification = ''
37        self.ReadOnly = False
38        self.RePackage = False
39        self.PackagePath = ''
40        self.ClonedFrom = []
41
42## PackageIndustryStdHeaderClass
43#
44# This class defined industry std header items used in Package file
45#
46# @param CommonHeaderClass:  Inherited from CommonHeaderClass class
47#
48# @var Name:                 To store value for Name
49# @var IncludeHeader:        To store value for IncludeHeader
50#
51class PackageIndustryStdHeaderClass(CommonClass):
52    def __init__(self):
53        self.Name = ''
54        self.IncludeHeader = ''
55        CommonClass.__init__(self)
56
57## PackageIncludePkgHeaderClass
58#
59# This class defined include Pkg header items used in Package file
60#
61# @param object:       Inherited from object class
62#
63# @var IncludeHeader:  To store value for IncludeHeader
64# @var ModuleType:     To store value for ModuleType, it is a set structure as
65#                      BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE
66#
67class PackageIncludePkgHeaderClass(object):
68    def __init__(self):
69        self.IncludeHeader = ''
70        self.ModuleType = []
71
72## PackageClass
73#
74# This class defined a complete package item
75#
76# @param object:                  Inherited from object class
77#
78# @var Header:                    To store value for Header, it is a structure as
79#                                 {Arch : PackageHeaderClass}
80# @var Includes:                  To store value for Includes, it is a list structure as
81#                                 [ IncludeClass, ...]
82# @var LibraryClassDeclarations:  To store value for LibraryClassDeclarations, it is a list structure as
83#                                 [ LibraryClassClass, ...]
84# @var IndustryStdHeaders:        To store value for IndustryStdHeaders, it is a list structure as
85#                                 [ PackageIndustryStdHeader, ...]
86# @var ModuleFiles:               To store value for ModuleFiles, it is a list structure as
87#                                 [ '', '', ...]
88# @var PackageIncludePkgHeaders:  To store value for PackageIncludePkgHeaders, it is a list structure as
89#                                 [ PackageIncludePkgHeader, ...]
90# @var GuidDeclarations:          To store value for GuidDeclarations, it is a list structure as
91#                                 [ GuidClass, ...]
92# @var ProtocolDeclarations:      To store value for ProtocolDeclarations, it is a list structure as
93#                                 [ ProtocolClass, ...]
94# @var PpiDeclarations:           To store value for PpiDeclarations, it is a list structure as
95#                                 [ PpiClass, ...]
96# @var PcdDeclarations:           To store value for PcdDeclarations, it is a list structure as
97#                                 [ PcdClass, ...]
98# @var UserExtensions:            To store value for UserExtensions, it is a list structure as
99#                                 [ UserExtensionsClass, ...]
100#
101class PackageClass(object):
102    def __init__(self):
103        self.PackageHeader = PackageHeaderClass()
104        self.Header = {}
105        self.Includes = []
106        self.LibraryClassDeclarations = []
107        self.IndustryStdHeaders = []
108        self.ModuleFiles = []
109        # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj}
110        self.Modules = sdict()
111        self.PackageIncludePkgHeaders = []
112        self.GuidDeclarations = []
113        self.ProtocolDeclarations = []
114        self.PpiDeclarations = []
115        self.PcdDeclarations = []
116        self.PcdChecks = []
117        self.UserExtensions = UserExtensionsClass()
118        self.MiscFiles = MiscFileClass()
119        self.FileList = []
120
121##
122#
123# This acts like the main() function for the script, unless it is 'import'ed into another
124# script.
125#
126if __name__ == '__main__':
127    P = PackageClass()
128