EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

BaseTools/Source/Python/Common/MigrationUtilities.py

Go to the documentation of this file.
00001 ## @file
00002 # Contains several utilitities shared by migration tools.
00003 #
00004 # Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
00005 # This program and the accompanying materials
00006 # are licensed and made available under the terms and conditions of the BSD License
00007 # which accompanies this distribution.  The full text of the license may be found at
00008 # http://opensource.org/licenses/bsd-license.php
00009 #
00010 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00011 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00012 #
00013 
00014 ##
00015 # Import Modules
00016 #
00017 import os
00018 import re
00019 import EdkLogger
00020 from optparse import OptionParser
00021 from Common.BuildToolError import *
00022 from XmlRoutines import *
00023 from CommonDataClass.CommonClass import *
00024 
00025 ## Set all fields of CommonClass object.
00026 #
00027 # Set all attributes of CommonClass object from XML Dom object of XmlCommon.
00028 #
00029 # @param  Common     The destine CommonClass object.
00030 # @param  XmlCommon  The source XML Dom object.
00031 #
00032 def SetCommon(Common, XmlCommon):
00033     XmlTag = "Usage"
00034     Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()
00035 
00036     XmlTag = "FeatureFlag"
00037     Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)
00038     
00039     XmlTag = "SupArchList"
00040     Common.SupArchList = XmlAttribute(XmlCommon, XmlTag).split()
00041     
00042     XmlTag = XmlNodeName(XmlCommon) + "/" + "HelpText"
00043     Common.HelpText = XmlElement(XmlCommon, XmlTag)
00044 
00045 
00046 ## Set some fields of CommonHeaderClass object.
00047 #
00048 # Set Name, Guid, FileName and FullPath fields of CommonHeaderClass object from
00049 # XML Dom object of XmlCommonHeader, NameTag and FileName.
00050 #
00051 # @param  CommonHeader       The destine CommonClass object.
00052 # @param  XmlCommonHeader    The source XML Dom object.
00053 # @param  NameTag            The name tag in XML Dom object.
00054 # @param  FileName           The file name of the XML file.
00055 #
00056 def SetIdentification(CommonHeader, XmlCommonHeader, NameTag, FileName):
00057     XmlParentTag = XmlNodeName(XmlCommonHeader)
00058     
00059     XmlTag = XmlParentTag + "/" + NameTag
00060     CommonHeader.Name = XmlElement(XmlCommonHeader, XmlTag)
00061 
00062     XmlTag = XmlParentTag + "/" + "GuidValue"
00063     CommonHeader.Guid = XmlElement(XmlCommonHeader, XmlTag)
00064 
00065     XmlTag = XmlParentTag + "/" + "Version"
00066     CommonHeader.Version = XmlElement(XmlCommonHeader, XmlTag)
00067 
00068     CommonHeader.FileName = os.path.basename(FileName)
00069     CommonHeader.FullPath = os.path.abspath(FileName)
00070 
00071 
00072 ## Regular expression to match specification and value.
00073 mReSpecification = re.compile(r"(?P<Specification>\w+)\s+(?P<Value>\w*)")
00074 
00075 ## Add specification to specification dictionary.
00076 #
00077 # Abstract specification name, value pair from Specification String and add them
00078 # to specification dictionary.
00079 #
00080 # @param  SpecificationDict   The destine Specification dictionary.
00081 # @param  SpecificationString The source Specification String from which the
00082 #                             specification name and value pair is abstracted.
00083 #
00084 def AddToSpecificationDict(SpecificationDict, SpecificationString):
00085     """Abstract specification name, value pair from Specification String"""
00086     for SpecificationMatch in mReSpecification.finditer(SpecificationString):
00087         Specification = SpecificationMatch.group("Specification")
00088         Value = SpecificationMatch.group("Value")
00089         SpecificationDict[Specification] = Value
00090 
00091 ## Set all fields of CommonHeaderClass object.
00092 #
00093 # Set all attributes of CommonHeaderClass object from XML Dom object of
00094 # XmlCommonHeader, NameTag and FileName.
00095 #
00096 # @param  CommonHeader       The destine CommonClass object.
00097 # @param  XmlCommonHeader    The source XML Dom object.
00098 # @param  NameTag            The name tag in XML Dom object.
00099 # @param  FileName           The file name of the XML file.
00100 #
00101 def SetCommonHeader(CommonHeader, XmlCommonHeader):
00102     """Set all attributes of CommonHeaderClass object from XmlCommonHeader"""
00103     XmlParent = XmlNodeName(XmlCommonHeader)
00104     
00105     XmlTag = XmlParent + "/" + "Abstract"
00106     CommonHeader.Abstract = XmlElement(XmlCommonHeader, XmlTag)
00107 
00108     XmlTag = XmlParent + "/" + "Description"
00109     CommonHeader.Description = XmlElement(XmlCommonHeader, XmlTag)
00110 
00111     XmlTag = XmlParent + "/" + "Copyright"
00112     CommonHeader.Copyright = XmlElement(XmlCommonHeader, XmlTag)
00113 
00114     XmlTag = XmlParent + "/" + "License"
00115     CommonHeader.License = XmlElement(XmlCommonHeader, XmlTag)
00116 
00117     XmlTag = XmlParent + "/" + "Specification"
00118     Specification = XmlElement(XmlCommonHeader, XmlTag)
00119 
00120     AddToSpecificationDict(CommonHeader.Specification, Specification)
00121 
00122     XmlTag = XmlParent + "/" + "ModuleType"
00123     CommonHeader.ModuleType = XmlElement(XmlCommonHeader, XmlTag)
00124 
00125 
00126 ## Load a new Cloned Record class object.
00127 #
00128 # Read an input XML ClonedRecord DOM object and return an object of Cloned Record
00129 # contained in the DOM object.
00130 #
00131 # @param  XmlCloned            A child XML DOM object in a Common XML DOM.
00132 #
00133 # @retvel ClonedRecord         A new Cloned Record object created by XmlCloned.
00134 #
00135 def LoadClonedRecord(XmlCloned):
00136     ClonedRecord = ClonedRecordClass()
00137 
00138     XmlTag = "Id"
00139     ClonedRecord.Id = int(XmlAttribute(XmlCloned, XmlTag))
00140 
00141     XmlTag = "FarGuid"
00142     ClonedRecord.FarGuid = XmlAttribute(XmlCloned, XmlTag)
00143 
00144     XmlTag = "Cloned/PackageGuid"
00145     ClonedRecord.PackageGuid = XmlElement(XmlCloned, XmlTag)
00146     
00147     XmlTag = "Cloned/PackageVersion"
00148     ClonedRecord.PackageVersion = XmlElement(XmlCloned, XmlTag)
00149     
00150     XmlTag = "Cloned/ModuleGuid"
00151     ClonedRecord.ModuleGuid = XmlElement(XmlCloned, XmlTag)
00152     
00153     XmlTag = "Cloned/ModuleVersion"
00154     ClonedRecord.ModuleVersion = XmlElement(XmlCloned, XmlTag)
00155     
00156     return ClonedRecord
00157 
00158 
00159 ## Load a new Guid/Protocol/Ppi common class object.
00160 #
00161 # Read an input XML Guid/Protocol/Ppi DOM object and return an object of
00162 # Guid/Protocol/Ppi contained in the DOM object.
00163 #
00164 # @param  XmlGuidProtocolPpiCommon A child XML DOM object in a Common XML DOM.
00165 #
00166 # @retvel GuidProtocolPpiCommon    A new GuidProtocolPpiCommon class object
00167 #                                  created by XmlGuidProtocolPpiCommon.
00168 #
00169 def LoadGuidProtocolPpiCommon(XmlGuidProtocolPpiCommon):
00170     GuidProtocolPpiCommon = GuidProtocolPpiCommonClass()
00171     
00172     XmlTag = "Name"
00173     GuidProtocolPpiCommon.Name = XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag)
00174 
00175     XmlParent = XmlNodeName(XmlGuidProtocolPpiCommon)
00176     if XmlParent == "Entry":
00177         XmlTag = "%s/C_Name" % XmlParent
00178     elif XmlParent == "GuidCNames":
00179         XmlTag = "%s/GuidCName" % XmlParent
00180     else:
00181         XmlTag = "%s/%sCName" % (XmlParent, XmlParent)
00182         
00183     GuidProtocolPpiCommon.CName = XmlElement(XmlGuidProtocolPpiCommon, XmlTag)
00184     
00185     XmlTag = XmlParent + "/" + "GuidValue"
00186     GuidProtocolPpiCommon.Guid = XmlElement(XmlGuidProtocolPpiCommon, XmlTag)
00187     
00188     if XmlParent.endswith("Notify"):
00189         GuidProtocolPpiCommon.Notify = True
00190 
00191     XmlTag = "GuidTypeList"
00192     GuidTypes = XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag)
00193     GuidProtocolPpiCommon.GuidTypeList = GuidTypes.split()
00194     
00195     XmlTag = "SupModuleList"
00196     SupModules = XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag)
00197     GuidProtocolPpiCommon.SupModuleList = SupModules.split()
00198 
00199     SetCommon(GuidProtocolPpiCommon, XmlGuidProtocolPpiCommon)
00200 
00201     return GuidProtocolPpiCommon
00202 
00203 
00204 ## Load a new Pcd class object.
00205 #
00206 # Read an input XML Pcd DOM object and return an object of Pcd
00207 # contained in the DOM object.
00208 #
00209 # @param  XmlPcd               A child XML DOM object in a Common XML DOM.
00210 #
00211 # @retvel Pcd                  A new Pcd object created by XmlPcd.
00212 #
00213 def LoadPcd(XmlPcd):
00214     """Return a new PcdClass object equivalent to XmlPcd"""
00215     Pcd = PcdClass()
00216 
00217     XmlTag = "PcdEntry/C_Name"
00218     Pcd.CName = XmlElement(XmlPcd, XmlTag)
00219 
00220     XmlTag = "PcdEntry/Token"
00221     Pcd.Token = XmlElement(XmlPcd, XmlTag)
00222 
00223     XmlTag = "PcdEntry/TokenSpaceGuidCName"
00224     Pcd.TokenSpaceGuidCName = XmlElement(XmlPcd, XmlTag)
00225 
00226     XmlTag = "PcdEntry/DatumType"
00227     Pcd.DatumType = XmlElement(XmlPcd, XmlTag)
00228 
00229     XmlTag = "PcdEntry/MaxDatumSize"
00230     Pcd.MaxDatumSize = XmlElement(XmlPcd, XmlTag)
00231 
00232     XmlTag = "PcdEntry/DefaultValue"
00233     Pcd.DefaultValue = XmlElement(XmlPcd, XmlTag)
00234 
00235     XmlTag = "PcdItemType"
00236     Pcd.ItemType = XmlAttribute(XmlPcd, XmlTag)
00237 
00238     XmlTag = "PcdEntry/ValidUsage"
00239     Pcd.ValidUsage = XmlElement(XmlPcd, XmlTag).split()
00240 
00241     XmlTag = "SupModuleList"
00242     Pcd.SupModuleList = XmlAttribute(XmlPcd, XmlTag).split()
00243 
00244     SetCommon(Pcd, XmlPcd)
00245 
00246     return Pcd
00247 
00248 
00249 ## Load a new LibraryClass class object.
00250 #
00251 # Read an input XML LibraryClass DOM object and return an object of LibraryClass
00252 # contained in the DOM object.
00253 #
00254 # @param  XmlLibraryClass    A child XML DOM object in a Common XML DOM.
00255 #
00256 # @retvel LibraryClass       A new LibraryClass object created by XmlLibraryClass.
00257 #
00258 def LoadLibraryClass(XmlLibraryClass):
00259     LibraryClass = LibraryClassClass()
00260 
00261     XmlTag = "LibraryClass/Keyword"
00262     LibraryClass.LibraryClass = XmlElement(XmlLibraryClass, XmlTag)
00263     if LibraryClass.LibraryClass == "":
00264         XmlTag = "Name"
00265         LibraryClass.LibraryClass = XmlAttribute(XmlLibraryClass, XmlTag)
00266     
00267     XmlTag = "LibraryClass/IncludeHeader"
00268     LibraryClass.IncludeHeader = XmlElement(XmlLibraryClass, XmlTag)
00269     
00270     XmlTag = "RecommendedInstanceVersion"
00271     RecommendedInstanceVersion = XmlAttribute(XmlLibraryClass, XmlTag)
00272     LibraryClass.RecommendedInstanceVersion = RecommendedInstanceVersion
00273     
00274     XmlTag = "RecommendedInstanceGuid"
00275     RecommendedInstanceGuid = XmlAttribute(XmlLibraryClass, XmlTag)
00276     LibraryClass.RecommendedInstanceGuid = RecommendedInstanceGuid
00277     
00278     XmlTag = "SupModuleList"
00279     SupModules = XmlAttribute(XmlLibraryClass, XmlTag)
00280     LibraryClass.SupModuleList = SupModules.split()
00281     
00282     SetCommon(LibraryClass, XmlLibraryClass)
00283     
00284     return LibraryClass
00285 
00286 
00287 ## Load a new Build Option class object.
00288 #
00289 # Read an input XML BuildOption DOM object and return an object of Build Option
00290 # contained in the DOM object.
00291 #
00292 # @param  XmlBuildOption       A child XML DOM object in a Common XML DOM.
00293 #
00294 # @retvel BuildOption          A new Build Option object created by XmlBuildOption.
00295 #
00296 def LoadBuildOption(XmlBuildOption):
00297     """Return a new BuildOptionClass object equivalent to XmlBuildOption"""
00298     BuildOption = BuildOptionClass()
00299     
00300     BuildOption.Option = XmlElementData(XmlBuildOption)
00301 
00302     XmlTag = "BuildTargets"
00303     BuildOption.BuildTargetList = XmlAttribute(XmlBuildOption, XmlTag).split()
00304     
00305     XmlTag = "ToolChainFamily"
00306     BuildOption.ToolChainFamily = XmlAttribute(XmlBuildOption, XmlTag)
00307     
00308     XmlTag = "TagName"
00309     BuildOption.TagName = XmlAttribute(XmlBuildOption, XmlTag)
00310     
00311     XmlTag = "ToolCode"
00312     BuildOption.ToolCode = XmlAttribute(XmlBuildOption, XmlTag)
00313     
00314     XmlTag = "SupArchList"
00315     BuildOption.SupArchList = XmlAttribute(XmlBuildOption, XmlTag).split()
00316     
00317     return BuildOption
00318 
00319 
00320 ## Load a new User Extensions class object.
00321 #
00322 # Read an input XML UserExtensions DOM object and return an object of User
00323 # Extensions contained in the DOM object.
00324 #
00325 # @param  XmlUserExtensions    A child XML DOM object in a Common XML DOM.
00326 #
00327 # @retvel UserExtensions       A new User Extensions object created by
00328 #                              XmlUserExtensions.
00329 #
00330 def LoadUserExtensions(XmlUserExtensions):
00331     UserExtensions = UserExtensionsClass()
00332     
00333     XmlTag = "UserID"
00334     UserExtensions.UserID = XmlAttribute(XmlUserExtensions, XmlTag)
00335     
00336     XmlTag = "Identifier"
00337     UserExtensions.Identifier = XmlAttribute(XmlUserExtensions, XmlTag)
00338     
00339     UserExtensions.Content = XmlElementData(XmlUserExtensions)
00340     
00341     return UserExtensions
00342 
00343 
00344 ## Store content to a text file object.
00345 #
00346 # Write some text file content to a text file object. The contents may echo
00347 # in screen in a verbose way.
00348 #
00349 # @param  TextFile           The text file object.
00350 # @param  Content            The string object to be written to a text file.
00351 #
00352 def StoreTextFile(TextFile, Content):
00353     EdkLogger.verbose(Content)
00354     TextFile.write(Content)
00355 
00356 
00357 ## Add item to a section.
00358 #
00359 # Add an Item with specific CPU architecture to section dictionary.
00360 # The possible duplication is ensured to be removed.
00361 #
00362 # @param  Section            Section dictionary indexed by CPU architecture.
00363 # @param  Arch               CPU architecture: Ia32, X64, Ipf, ARM, Ebc or Common.
00364 # @param  Item               The Item to be added to section dictionary.
00365 #
00366 def AddToSection(Section, Arch, Item):
00367     SectionArch = Section.get(Arch, [])
00368     if Item not in SectionArch:
00369         SectionArch.append(Item)
00370         Section[Arch] = SectionArch
00371 
00372 
00373 ## Get section contents.
00374 #
00375 # Return the content of section named SectionName.
00376 # the contents is based on Methods and ObjectLists.
00377 #
00378 # @param  SectionName        The name of the section.
00379 # @param  Method             A function returning a string item of an object.
00380 # @param  ObjectList         The list of object.
00381 #
00382 # @retval Section            The string content of a section.
00383 #
00384 def GetSection(SectionName, Method, ObjectList):
00385     SupportedArches = ["common", "Ia32", "X64", "Ipf", "Ebc", "ARM"]
00386     SectionDict = {}
00387     for Object in ObjectList:
00388         Item = Method(Object)
00389         if Item == "":
00390             continue
00391         Item = "  %s" % Item
00392         Arches = Object.SupArchList
00393         if len(Arches) == 0:
00394             AddToSection(SectionDict, "common", Item)
00395         else:
00396             for Arch in SupportedArches:
00397                 if Arch.upper() in Arches:
00398                     AddToSection(SectionDict, Arch, Item)
00399 
00400     Section = ""
00401     for Arch in SupportedArches:
00402         SectionArch = "\n".join(SectionDict.get(Arch, []))
00403         if SectionArch != "":
00404             Section += "[%s.%s]\n%s\n" % (SectionName, Arch, SectionArch)
00405             Section += "\n"
00406     if Section != "":
00407         Section += "\n"
00408     return Section
00409 
00410 
00411 ## Store file header to a text file.
00412 #
00413 # Write standard file header to a text file. The content includes copyright,
00414 # abstract, description and license extracted from CommonHeader class object.
00415 #
00416 # @param  TextFile           The text file object.
00417 # @param  CommonHeader       The source CommonHeader class object.
00418 #
00419 def StoreHeader(TextFile, CommonHeader):
00420     CopyRight = CommonHeader.Copyright
00421     Abstract = CommonHeader.Abstract
00422     Description = CommonHeader.Description
00423     License = CommonHeader.License
00424 
00425     Header =  "#/** @file\n#\n"
00426     Header += "# " + Abstract + "\n#\n"
00427     Header += "# " + Description.strip().replace("\n", "\n# ") + "\n"
00428     Header += "# " + CopyRight + "\n#\n"
00429     Header += "#  " + License.replace("\n", "\n# ").replace("  ", " ")
00430     Header += "\n#\n#**/\n\n"
00431 
00432     StoreTextFile(TextFile, Header)
00433 
00434 ## Store file header to a text file.
00435 #
00436 # Write Defines section to a text file. DefinesTupleList determines the content.
00437 #
00438 # @param  TextFile           The text file object.
00439 # @param  DefinesTupleList   The list of (Tag, Value) to be added as one item.
00440 #
00441 def StoreDefinesSection(TextFile, DefinesTupleList):
00442     Section = "[Defines]\n"
00443     for DefineItem in DefinesTupleList:
00444         Section += "  %-30s = %s\n" % DefineItem
00445 
00446     Section += "\n\n"
00447     StoreTextFile(TextFile, Section)
00448 
00449 
00450 ## Return one User Extension section.
00451 #
00452 # Read the input UserExtentsions class object and return one section.
00453 #
00454 # @param  UserExtensions       An input UserExtensions class object.
00455 #
00456 # @retval UserExtensionSection A section representing UserExtensions object.
00457 #
00458 def GetUserExtensions(UserExtensions):
00459     UserId = UserExtensions.UserID
00460     Identifier = UserExtensions.Identifier
00461     Content = UserExtensions.Content
00462 
00463     return "[UserExtensions.%s.%s]\n  %s\n\n" % (UserId, Identifier, Content)
00464 
00465 ## Regular expression to match an equation.
00466 mReEquation = re.compile(r"\s*(\S+)\s*=\s*(\S*)\s*")
00467 
00468 ## Return a value tuple matching information in a text fle.
00469 #
00470 # Parse the text file and return a value tuple corresponding to an input tag
00471 # tuple. In case of any error, an tuple of empty strings is returned.
00472 #
00473 # @param  FileName           The file name of the text file.
00474 # @param  TagTuple           A tuple of tags as the key to the value.
00475 #
00476 # @param  ValueTupe          The returned tuple corresponding to the tag tuple.
00477 #
00478 def GetTextFileInfo(FileName, TagTuple):
00479     ValueTuple = [""] * len(TagTuple)
00480     try:
00481         for Line in open(FileName):
00482             Line = Line.split("#", 1)[0]
00483             MatchEquation = mReEquation.match(Line)
00484             if MatchEquation:
00485                 Tag = MatchEquation.group(1).upper()
00486                 Value = MatchEquation.group(2)
00487                 for Index in range(len(TagTuple)):
00488                     if TagTuple[Index] == Tag:
00489                         ValueTuple[Index] = Value
00490     except:
00491         EdkLogger.info("IO Error in reading file %s" % FileName)
00492         
00493     return ValueTuple
00494 
00495 
00496 ## Return a value tuple matching information in an XML fle.
00497 #
00498 # Parse the XML file and return a value tuple corresponding to an input tag
00499 # tuple. In case of any error, an tuple of empty strings is returned.
00500 #
00501 # @param  FileName           The file name of the XML file.
00502 # @param  TagTuple           A tuple of tags as the key to the value.
00503 #
00504 # @param  ValueTupe          The returned tuple corresponding to the tag tuple.
00505 #
00506 def GetXmlFileInfo(FileName, TagTuple):
00507     XmlDom = XmlParseFile(FileName)
00508     return tuple([XmlElement(XmlDom, XmlTag) for XmlTag in TagTuple])
00509 
00510 
00511 ## Parse migration command line options
00512 #
00513 # Use standard Python module optparse to parse command line option of this tool.
00514 #
00515 # @param  Source             The source file type.
00516 # @param  Destinate          The destinate file type.
00517 #
00518 # @retval Options            A optparse object containing the parsed options.
00519 # @retval InputFile          Path of an source file to be migrated.
00520 #
00521 def MigrationOptionParser(Source, Destinate, ToolName, VersionNumber = 1.0):
00522     # use clearer usage to override default usage message
00523     UsageString = "%s [-a] [-v|-q] [-o <output_file>] <input_file>" % ToolName
00524     Version = "%s Version %.2f" % (ToolName, VersionNumber)
00525     Copyright = "Copyright (c) 2007, Intel Corporation. All rights reserved."
00526     
00527     Parser = OptionParser(description=Copyright, version=Version, usage=UsageString)
00528     Parser.add_option("-o", "--output", dest="OutputFile", help="The name of the %s file to be created." % Destinate)
00529     Parser.add_option("-a", "--auto", dest="AutoWrite", action="store_true", default=False, help="Automatically create the %s file using the name of the %s file and replacing file extension" % (Source, Destinate))
00530     Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
00531     Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed.")
00532 
00533     Options, Args = Parser.parse_args()
00534 
00535     # Set logging level
00536     if Options.verbose:
00537         EdkLogger.setLevel(EdkLogger.VERBOSE)
00538     elif Options.quiet:
00539         EdkLogger.setLevel(EdkLogger.QUIET)
00540     else:
00541         EdkLogger.setLevel(EdkLogger.INFO)
00542         
00543     # error check
00544     if len(Args) == 0:
00545         raise MigrationError(PARAMETER_MISSING, name="Input file", usage=Parser.get_usage())
00546     if len(Args) > 1:
00547         raise MigrationError(PARAMETER_INVALID, name="Too many input files", usage=Parser.get_usage())
00548 
00549     InputFile = Args[0]
00550     if not os.path.exists(InputFile):
00551         raise MigrationError(FILE_NOT_FOUND, name=InputFile)
00552 
00553     if Options.OutputFile:
00554         if Options.AutoWrite:
00555             raise MigrationError(OPTION_CONFLICT, arg1="-o", arg2="-a", usage=Parser.get_usage())
00556     else:
00557         if Options.AutoWrite:
00558             Options.OutputFile = os.path.splitext(InputFile)[0] + "." + Destinate.lower()
00559         else:
00560             raise MigrationError(OPTION_MISSING, name="-o", usage=Parser.get_usage())
00561 
00562     return Options, InputFile
00563 
00564 # This acts like the main() function for the script, unless it is 'import'ed
00565 # into another script.
00566 if __name__ == '__main__':
00567     pass
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines