public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Subject: [PATCH v1 00/11] BaseTools refactoring
Date: Mon, 14 May 2018 11:09:09 -0700	[thread overview]
Message-ID: <cover.1526321052.git.jaben.carsey@intel.com> (raw)

This patch cleans up BaseTools.
On classes that are not instantiated and are deisgned as purely base classes,
they get marked using the abstract base class to prevent instantiation.  This
prevents future errors.
Create a new shared base class to centralize some code that was identical in
multiple classes.
cleanup to pass tuples to startswith and endswith instead of calling multiple
times in a single expression.
when an statement used a fixed list or tuple change to a set to allow
hashing to speed up the operation.  if the order was important then make sure
that is a list.  creating on the fly tuples serves no purpose.
use with statements for file opening and make sure we dont over request file
privilidge.  this also seems to have cleaned up the error about the file
AutoGenTimeStamp which was causing errors previously.
lots of work to elimiate concatenating strings as this is a poor performing
operation since strings are immutable and must be completely reallocated and
moved for each concatenation.

Jaben Carsey (11):
  BaseTools: decorate base classes to prevent instantiation
  BaseTools: Workspace - create a base class
  BaseTools: remove unused code
  BaseTools: remove repeated calls to startswith/endswith
  BaseTools: use set presence instead of series of equality
  BaseTools: refactor section generation
  BaseTools: refactor file opening/writing
  BaseTools: refactor to change object types
  BaseTools: refactor to stop re-allocating strings
  BaseTools: change to set for membership testing
  BaseTools: remove extra assignment

 BaseTools/Source/Python/AutoGen/AutoGen.py                      | 248 ++++++++++----------
 BaseTools/Source/Python/AutoGen/GenC.py                         |  75 +++---
 BaseTools/Source/Python/AutoGen/GenDepex.py                     |  42 ++--
 BaseTools/Source/Python/AutoGen/GenMake.py                      |  43 ++--
 BaseTools/Source/Python/AutoGen/GenPcdDb.py                     |  52 ++--
 BaseTools/Source/Python/AutoGen/GenVar.py                       |   6 +-
 BaseTools/Source/Python/AutoGen/IdfClassObject.py               |  21 +-
 BaseTools/Source/Python/AutoGen/StrGather.py                    |  22 +-
 BaseTools/Source/Python/AutoGen/UniClassObject.py               |   8 +-
 BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py      |  32 ++-
 BaseTools/Source/Python/BPDG/BPDG.py                            |   2 +-
 BaseTools/Source/Python/BPDG/GenVpd.py                          |  38 ++-
 BaseTools/Source/Python/Common/DataType.py                      |  37 ++-
 BaseTools/Source/Python/Common/Expression.py                    |  68 +++---
 BaseTools/Source/Python/Common/Misc.py                          |  77 +++---
 BaseTools/Source/Python/Common/Parsing.py                       |   2 +-
 BaseTools/Source/Python/Common/RangeExpression.py               |  10 +-
 BaseTools/Source/Python/Common/String.py                        |   2 +-
 BaseTools/Source/Python/Common/TargetTxtClassObject.py          |  21 +-
 BaseTools/Source/Python/Common/ToolDefClassObject.py            |   4 +-
 BaseTools/Source/Python/Common/VariableAttributes.py            |   6 +-
 BaseTools/Source/Python/Common/VpdInfoFile.py                   |   4 +-
 BaseTools/Source/Python/CommonDataClass/CommonClass.py          |  29 +--
 BaseTools/Source/Python/CommonDataClass/DataClass.py            |  47 +---
 BaseTools/Source/Python/Ecc/Check.py                            | 123 +---------
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py            |   4 +-
 BaseTools/Source/Python/Ecc/Configuration.py                    |  10 +-
 BaseTools/Source/Python/Ecc/Database.py                         |  76 +-----
 BaseTools/Source/Python/Ecc/Ecc.py                              |   4 +-
 BaseTools/Source/Python/Ecc/MetaDataParser.py                   |   4 +-
 BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py |  54 +++--
 BaseTools/Source/Python/Ecc/c.py                                |  42 ++--
 BaseTools/Source/Python/Eot/CodeFragmentCollector.py            |   9 +-
 BaseTools/Source/Python/Eot/EotGlobalData.py                    |  14 +-
 BaseTools/Source/Python/Eot/FileProfile.py                      |   8 +-
 BaseTools/Source/Python/Eot/Parser.py                           |   4 +-
 BaseTools/Source/Python/Eot/Report.py                           |  19 +-
 BaseTools/Source/Python/Eot/c.py                                |   2 +-
 BaseTools/Source/Python/GenFds/Capsule.py                       |  26 +-
 BaseTools/Source/Python/GenFds/CapsuleData.py                   |  11 +-
 BaseTools/Source/Python/GenFds/CompressSection.py               |  24 +-
 BaseTools/Source/Python/GenFds/DataSection.py                   |  32 +--
 BaseTools/Source/Python/GenFds/DepexSection.py                  |   8 +-
 BaseTools/Source/Python/GenFds/EfiSection.py                    | 111 ++++-----
 BaseTools/Source/Python/GenFds/FdfParser.py                     | 195 ++++++++-------
 BaseTools/Source/Python/GenFds/Ffs.py                           |  88 +++----
 BaseTools/Source/Python/GenFds/FfsFileStatement.py              |   9 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py               |  28 +--
 BaseTools/Source/Python/GenFds/Fv.py                            | 112 +++------
 BaseTools/Source/Python/GenFds/FvImageSection.py                |  38 ++-
 BaseTools/Source/Python/GenFds/GenFds.py                        |   8 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py          |  65 ++---
 BaseTools/Source/Python/GenFds/GuidSection.py                   |  71 +++---
 BaseTools/Source/Python/GenFds/OptRomInfStatement.py            |  15 +-
 BaseTools/Source/Python/GenFds/OptionRom.py                     |   2 -
 BaseTools/Source/Python/GenFds/Region.py                        |  17 +-
 BaseTools/Source/Python/GenFds/Section.py                       | 231 ++++++++----------
 BaseTools/Source/Python/GenFds/UiSection.py                     |  22 +-
 BaseTools/Source/Python/GenFds/VerSection.py                    |  26 +-
 BaseTools/Source/Python/GenFds/Vtf.py                           | 108 +++------
 BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py    |  21 +-
 BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py          |  39 +--
 BaseTools/Source/Python/Table/Table.py                          |   6 +-
 BaseTools/Source/Python/Table/TableDataModel.py                 |  11 +-
 BaseTools/Source/Python/Table/TableReport.py                    |  47 ++--
 BaseTools/Source/Python/TargetTool/TargetTool.py                |  97 ++++----
 BaseTools/Source/Python/Trim/Trim.py                            |  76 +++---
 BaseTools/Source/Python/Workspace/BuildClassObject.py           | 149 +++++-------
 BaseTools/Source/Python/Workspace/DecBuildData.py               |   2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py               | 119 +++++-----
 BaseTools/Source/Python/Workspace/InfBuildData.py               |  32 +--
 BaseTools/Source/Python/Workspace/MetaDataTable.py              |  10 +-
 BaseTools/Source/Python/Workspace/MetaFileCommentParser.py      |   4 +-
 BaseTools/Source/Python/Workspace/MetaFileParser.py             |  74 +++---
 BaseTools/Source/Python/Workspace/WorkspaceCommon.py            |  20 +-
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py          |  18 +-
 BaseTools/Source/Python/build/BuildReport.py                    | 115 +++++----
 BaseTools/Source/Python/build/build.py                          | 140 ++++++-----
 78 files changed, 1478 insertions(+), 2018 deletions(-)

-- 
2.16.2.windows.1



             reply	other threads:[~2018-05-14 18:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 18:09 Jaben Carsey [this message]
2018-05-14 18:09 ` [PATCH v1 01/11] BaseTools: decorate base classes to prevent instantiation Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 02/11] BaseTools: Workspace - create a base class Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 03/11] BaseTools: remove unused code Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 04/11] BaseTools: remove repeated calls to startswith/endswith Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 05/11] BaseTools: use set presence instead of series of equality Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 06/11] BaseTools: refactor section generation Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 07/11] BaseTools: refactor file opening/writing Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 08/11] BaseTools: refactor to change object types Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 09/11] BaseTools: refactor to stop re-allocating strings Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 10/11] BaseTools: change to set for membership testing Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 11/11] BaseTools: remove extra assignment Jaben Carsey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1526321052.git.jaben.carsey@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox