public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch V2] BaseTools: Clean up not used code in BuildClassObject
@ 2018-08-13  8:11 Yonghong Zhu
  2018-08-14 14:58 ` Carsey, Jaben
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-08-13  8:11 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Jaben Carsey

V2: Add back "from Common.DataType import *"

1. Remove some import statement that are not used.
2. Remove the Type value in the LibraryClassObject because we don't
actually use it.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 3b47715..88465c5 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -9,15 +9,10 @@
 #
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
-import Common.LongFilePathOs as os
-
-from collections import OrderedDict
-from Common.Misc import RealPath2
-from Common.BuildToolError import *
 from Common.DataType import *
 import collections
 
 ## PcdClassObject
 #
@@ -251,22 +246,18 @@ class StructurePcd(PcdClassObject):
 # This Class defines LibraryClassObject used in BuildDatabase
 #
 # @param object:      Inherited from object class
 # @param Name:        Input value for LibraryClassName, default is None
 # @param SupModList:  Input value for SupModList, default is []
-# @param Type:        Input value for Type, default is None
 #
 # @var LibraryClass:  To store value for LibraryClass
 # @var SupModList:    To store value for SupModList
-# @var Type:          To store value for Type
 #
 class LibraryClassObject(object):
-    def __init__(self, Name = None, SupModList = [], Type = None):
+    def __init__(self, Name = None, SupModList = []):
         self.LibraryClass = Name
         self.SupModList = SupModList
-        if Type is not None:
-            self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)
 
 ## ModuleBuildClassObject
 #
 # This Class defines ModuleBuildClass
 #
@@ -330,11 +321,11 @@ class ModuleBuildClassObject(object):
         self.ConstructorList         = []
         self.DestructorList          = []
 
         self.Binaries                = []
         self.Sources                 = []
-        self.LibraryClasses          = OrderedDict()
+        self.LibraryClasses          = collections.OrderedDict()
         self.Libraries               = []
         self.Protocols               = []
         self.Ppis                    = []
         self.Guids                   = []
         self.Includes                = []
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch V2] BaseTools: Clean up not used code in BuildClassObject
  2018-08-13  8:11 [Patch V2] BaseTools: Clean up not used code in BuildClassObject Yonghong Zhu
@ 2018-08-14 14:58 ` Carsey, Jaben
  0 siblings, 0 replies; 2+ messages in thread
From: Carsey, Jaben @ 2018-08-14 14:58 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Gao, Liming

I believe that we should try to move more towards specific imports rather than import * or entire modules.  I would therefore prefer we do the OrderedDict change in the other direction and remove the collections.OrderedDict items.  That being said, opinions... The code is still better with this change.

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Monday, August 13, 2018 1:12 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Subject: [Patch V2] BaseTools: Clean up not used code in BuildClassObject
> Importance: High
> 
> V2: Add back "from Common.DataType import *"
> 
> 1. Remove some import statement that are not used.
> 2. Remove the Type value in the LibraryClassObject because we don't
> actually use it.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BaseTools/Source/Python/Workspace/BuildClassObject.py | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index 3b47715..88465c5 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -9,15 +9,10 @@
>  #
>  # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
>  # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
>  #
> 
> -import Common.LongFilePathOs as os
> -
> -from collections import OrderedDict
> -from Common.Misc import RealPath2
> -from Common.BuildToolError import *
>  from Common.DataType import *
>  import collections
> 
>  ## PcdClassObject
>  #
> @@ -251,22 +246,18 @@ class StructurePcd(PcdClassObject):
>  # This Class defines LibraryClassObject used in BuildDatabase
>  #
>  # @param object:      Inherited from object class
>  # @param Name:        Input value for LibraryClassName, default is None
>  # @param SupModList:  Input value for SupModList, default is []
> -# @param Type:        Input value for Type, default is None
>  #
>  # @var LibraryClass:  To store value for LibraryClass
>  # @var SupModList:    To store value for SupModList
> -# @var Type:          To store value for Type
>  #
>  class LibraryClassObject(object):
> -    def __init__(self, Name = None, SupModList = [], Type = None):
> +    def __init__(self, Name = None, SupModList = []):
>          self.LibraryClass = Name
>          self.SupModList = SupModList
> -        if Type is not None:
> -            self.SupModList =
> CleanString(Type).split(DataType.TAB_SPACE_SPLIT)
> 
>  ## ModuleBuildClassObject
>  #
>  # This Class defines ModuleBuildClass
>  #
> @@ -330,11 +321,11 @@ class ModuleBuildClassObject(object):
>          self.ConstructorList         = []
>          self.DestructorList          = []
> 
>          self.Binaries                = []
>          self.Sources                 = []
> -        self.LibraryClasses          = OrderedDict()
> +        self.LibraryClasses          = collections.OrderedDict()
>          self.Libraries               = []
>          self.Protocols               = []
>          self.Ppis                    = []
>          self.Guids                   = []
>          self.Includes                = []
> --
> 2.6.1.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-14 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-13  8:11 [Patch V2] BaseTools: Clean up not used code in BuildClassObject Yonghong Zhu
2018-08-14 14:58 ` Carsey, Jaben

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox