From: "Cole" <crobinso@redhat.com>
To: devel@edk2.groups.io
Cc: Cole Robinson <crobinso@redhat.com>
Subject: [PATCH 2/3] python: Replace distutils.utils.split_quotes with shlex.split
Date: Fri, 23 Jul 2021 16:02:27 -0400 [thread overview]
Message-ID: <77f2b41ac406a86ad62d5eb1bc88350cd10468a8.1627070203.git.crobinso@redhat.com> (raw)
In-Reply-To: <cover.1627070203.git.crobinso@redhat.com>
distutils is deprecated and may be removed in python 3.12.
Use shlex.split which has been around since python 2.3.
shlex.split does not split on all the ASCII control characters that
split_quoted will[1], but for edk2 usage I don't think that matters.
[1] https://stackoverflow.com/questions/54999301/what-is-the-difference-between-distutils-util-split-quoted-and-shlex-split
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 ++--
BaseTools/Source/Python/UPT/Library/UniClassObject.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index 883c2356e0..b16330e368 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -12,7 +12,7 @@
#
from __future__ import print_function
import Common.LongFilePathOs as os, codecs, re
-import distutils.util
+import shlex
import Common.EdkLogger as EdkLogger
from io import BytesIO
from Common.BuildToolError import *
@@ -233,7 +233,7 @@ class UniFileClassObject(object):
# Get Language definition
#
def GetLangDef(self, File, Line):
- Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
+ Lang = shlex.split(Line.split(u"//")[0])
if len(Lang) != 3:
try:
FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
index d25f300146..8c44dc2252 100644
--- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py
+++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -14,7 +14,7 @@ from __future__ import print_function
# Import Modules
#
import os, codecs, re
-import distutils.util
+import shlex
from Logger import ToolError
from Logger import Log as EdkLogger
from Logger import StringTable as ST
@@ -320,7 +320,7 @@ class UniFileClassObject(object):
# Get Language definition
#
def GetLangDef(self, File, Line):
- Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
+ Lang = shlex.split(Line.split(u"//")[0])
if len(Lang) != 3:
try:
FileIn = codecs.open(File.Path, mode='rb', encoding='utf_8').readlines()
--
2.31.1
next prev parent reply other threads:[~2021-07-23 20:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-23 20:02 [PATCH 0/3] BaseTools: fix some python DeprecationWarnings Cole
2021-07-23 20:02 ` [PATCH 1/3] build: Fix python3.10 threading DeprecationWarnings Cole
2021-07-23 20:02 ` Cole [this message]
2021-07-23 20:02 ` [PATCH 3/3] BaseTools: Drop check for distutils.utils Cole
2021-07-26 6:20 ` [edk2-devel] " Yuwei Chen
2021-07-26 3:52 ` [edk2-devel] [PATCH 0/3] BaseTools: fix some python DeprecationWarnings Bob Feng
2021-08-10 7:48 ` Yuwei Chen
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=77f2b41ac406a86ad62d5eb1bc88350cd10468a8.1627070203.git.crobinso@redhat.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