]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: remove the not used PyUtility file
authorYonghong Zhu <yonghong.zhu@intel.com>
Thu, 13 Sep 2018 06:12:00 +0000 (14:12 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 13 Oct 2018 02:06:12 +0000 (10:06 +0800)
the PyUtility is not used, so we remove it.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/PyUtility/Makefile [deleted file]
BaseTools/Source/C/PyUtility/PyUtility.c [deleted file]
BaseTools/Source/C/PyUtility/setup.py [deleted file]
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Common/PyUtility.pyd [deleted file]

diff --git a/BaseTools/Source/C/PyUtility/Makefile b/BaseTools/Source/C/PyUtility/Makefile
deleted file mode 100644 (file)
index 5829070..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-## @file\r
-# Makefile\r
-#\r
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.    The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-\r
-!INCLUDE ..\Makefiles\ms.common\r
-\r
-APPNAME = GenSec\r
-\r
-LIBS = $(LIB_PATH)\Common.lib\r
-\r
-OBJECTS = PyUtility.obj\r
-\r
-#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib\r
-\r
-!INCLUDE ..\Makefiles\ms.app\r
-\r
diff --git a/BaseTools/Source/C/PyUtility/PyUtility.c b/BaseTools/Source/C/PyUtility/PyUtility.c
deleted file mode 100644 (file)
index d14b872..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file\r
-Python Utility\r
-\r
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available\r
-under the terms and conditions of the BSD License which accompanies this\r
-distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Python.h>\r
-#include <Windows.h>\r
-#include <Common/UefiBaseTypes.h>\r
-\r
-/*\r
- SaveFileToDisk(FilePath, Content)\r
-*/\r
-STATIC\r
-PyObject*\r
-SaveFileToDisk (\r
-  PyObject    *Self,\r
-  PyObject    *Args\r
-  )\r
-{\r
-  CHAR8         *File;\r
-  UINT8         *Data;\r
-  UINTN         DataLength;\r
-  UINTN         WriteBytes;\r
-  UINTN         Status;\r
-  HANDLE        FileHandle;\r
-  PyObject      *ReturnValue = Py_False;\r
-\r
-  Status = PyArg_ParseTuple(\r
-            Args,\r
-            "ss#",\r
-            &File,\r
-            &Data,\r
-            &DataLength\r
-            );\r
-  if (Status == 0) {\r
-    return NULL;\r
-  }\r
-\r
-  FileHandle = CreateFile(\r
-                File,\r
-                GENERIC_WRITE,\r
-                FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_SHARE_DELETE,\r
-                NULL,\r
-                CREATE_ALWAYS,\r
-                FILE_ATTRIBUTE_NORMAL,\r
-                NULL\r
-                );\r
-  if (FileHandle == INVALID_HANDLE_VALUE) {\r
-    PyErr_SetString(PyExc_Exception, "File creation failure");\r
-    return NULL;\r
-  }\r
-\r
-  while (WriteFile(FileHandle, Data, DataLength, &WriteBytes, NULL)) {\r
-    if (DataLength <= WriteBytes) {\r
-      DataLength = 0;\r
-      break;\r
-    }\r
-\r
-    Data += WriteBytes;\r
-    DataLength -= WriteBytes;\r
-  }\r
-\r
-  if (DataLength != 0) {\r
-    // file saved unsuccessfully\r
-    PyErr_SetString(PyExc_Exception, "File write failure");\r
-    goto Done;\r
-  }\r
-\r
-  //\r
-  // Flush buffer may slow down the whole build performance (average 10s slower)\r
-  //\r
-  //if (!FlushFileBuffers(FileHandle)) {\r
-  //  PyErr_SetString(PyExc_Exception, "File flush failure");\r
-  //  goto Done;\r
-  //}\r
-\r
-  // success!\r
-  ReturnValue = Py_True;\r
-\r
-Done:\r
-  CloseHandle(FileHandle);\r
-  return ReturnValue;\r
-}\r
-\r
-STATIC INT8 SaveFileToDiskDocs[] = "SaveFileToDisk(): Make sure the file is saved to disk\n";\r
-\r
-STATIC PyMethodDef PyUtility_Funcs[] = {\r
-  {"SaveFileToDisk", (PyCFunction)SaveFileToDisk, METH_VARARGS, SaveFileToDiskDocs},\r
-  {NULL, NULL, 0, NULL}\r
-};\r
-\r
-PyMODINIT_FUNC\r
-initPyUtility(VOID) {\r
-  Py_InitModule3("PyUtility", PyUtility_Funcs, "Utilties Module Implemented C Language");\r
-}\r
-\r
-\r
diff --git a/BaseTools/Source/C/PyUtility/setup.py b/BaseTools/Source/C/PyUtility/setup.py
deleted file mode 100644 (file)
index e4d407d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-## @file\r
-# package and install PyEfiCompressor extension\r
-#\r
-#  Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\r
-#\r
-#  This program and the accompanying materials\r
-#  are licensed and made available under the terms and conditions of the BSD License\r
-#  which accompanies this distribution.  The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-\r
-##\r
-# Import Modules\r
-#\r
-from distutils.core import setup, Extension\r
-import os\r
-\r
-if 'BASE_TOOLS_PATH' not in os.environ:\r
-    raise "Please define BASE_TOOLS_PATH to the root of base tools tree"\r
-\r
-BaseToolsDir = os.environ['BASE_TOOLS_PATH']\r
-setup(\r
-    name="PyUtility",\r
-    version="0.01",\r
-    ext_modules=[\r
-        Extension(\r
-            'PyUtility',\r
-            sources=[\r
-                'PyUtility.c'\r
-                ],\r
-            include_dirs=[\r
-                os.path.join(BaseToolsDir, 'Source', 'C', 'Include'),\r
-                os.path.join(BaseToolsDir, 'Source', 'C', 'Include', 'Ia32'),\r
-                os.path.join(BaseToolsDir, 'Source', 'C', 'Common')\r
-                ],\r
-            )\r
-        ],\r
-  )\r
-\r
index 69d306b939cea4ce87e1b0ca4f4917754a05a042..2ac592d26bac82e78fb39cf95f30fc0e9a4e7da2 100644 (file)
@@ -477,25 +477,12 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True):
             EdkLogger.error(None, PERMISSION_FAILURE, "Do not have write permission on directory %s" % DirName)\r
 \r
     try:\r
-        if GlobalData.gIsWindows:\r
-            try:\r
-                from .PyUtility import SaveFileToDisk\r
-                if not SaveFileToDisk(File, Content):\r
-                    EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData=File)\r
-            except:\r
-                if isinstance(Content, bytes):\r
-                    with open(File, "wb") as Fd:\r
-                        Fd.write(Content)\r
-                else:\r
-                    with open(File, "w") as Fd:\r
-                        Fd.write(Content)\r
+        if isinstance(Content, bytes):\r
+            with open(File, "wb") as Fd:\r
+                Fd.write(Content)\r
         else:\r
-            if isinstance(Content, bytes):\r
-                with open(File, "wb") as Fd:\r
-                    Fd.write(Content)\r
-            else:\r
-                with open(File, "w") as Fd:\r
-                    Fd.write(Content)\r
+            with open(File, "w") as Fd:\r
+                Fd.write(Content)\r
     except IOError as X:\r
         EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s' % X)\r
 \r
diff --git a/BaseTools/Source/Python/Common/PyUtility.pyd b/BaseTools/Source/Python/Common/PyUtility.pyd
deleted file mode 100644 (file)
index 856b508..0000000
Binary files a/BaseTools/Source/Python/Common/PyUtility.pyd and /dev/null differ