diff options
| author | Antaeus Kleinert-Strand <antklein@microsoft.com> | 2026-10-27 21:23:25 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2026-10-31 05:12:04 +0300 |
| commit | 10ef465ee2d6d42803e60075399aafb4ec0fa9a2 (patch) | |
| tree | 9e03dc59f8e14c252f4f303d548a86b802e73aef /BaseTools/Source/Python | |
| parent | e76e710ad875c13413b55b94bf3599dbb377a025 (diff) | |
| download | edk2-10ef465ee2d6d42803e60075399aafb4ec0fa9a2.tar.xz | |
BaseTools: Rename workspace os alias and clean up imports
Rename the LongFilePathOs import alias from os to Os and update its
references without changing workspace behavior.
Remove unused os and sys imports from the Python test runner and
normalize blank lines in both files.
Signed-off-by: Antaeus Kleinert-Strand <antklein@microsoft.com>
Diffstat (limited to 'BaseTools/Source/Python')
| -rw-r--r-- | BaseTools/Source/Python/Common/MultipleWorkspace.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/BaseTools/Source/Python/Common/MultipleWorkspace.py b/BaseTools/Source/Python/Common/MultipleWorkspace.py index 0ddb14f4b5..a17e196962 100644 --- a/BaseTools/Source/Python/Common/MultipleWorkspace.py +++ b/BaseTools/Source/Python/Common/MultipleWorkspace.py @@ -8,9 +8,10 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent
#
-import Common.LongFilePathOs as os
+import Common.LongFilePathOs as Os
from Common.DataType import TAB_WORKSPACE
+
## MultipleWorkspace
#
# This class manage multiple workspace behavior
@@ -34,8 +35,8 @@ class MultipleWorkspace(object): #
@classmethod
def convertPackagePath(cls, Ws, Path):
- if str(os.path.normcase (os.path.normpath(Path))).startswith(os.path.normcase(os.path.normpath(Ws))):
- return os.path.join(Ws, os.path.relpath(Path, Ws))
+ if str(Os.path.normcase (Os.path.normpath(Path))).startswith(Os.path.normcase(Os.path.normpath(Ws))):
+ return Os.path.join(Ws, Os.path.relpath(Path, Ws))
return Path
## setWs()
@@ -50,7 +51,7 @@ class MultipleWorkspace(object): def setWs(cls, Ws, PackagesPath=None):
cls.WORKSPACE = Ws
if PackagesPath:
- cls.PACKAGES_PATH = [cls.convertPackagePath (Ws, os.path.normpath(Path.strip())) for Path in PackagesPath.split(os.pathsep)]
+ cls.PACKAGES_PATH = [cls.convertPackagePath (Ws, Os.path.normpath(Path.strip())) for Path in PackagesPath.split(Os.pathsep)]
else:
cls.PACKAGES_PATH = []
@@ -65,13 +66,13 @@ class MultipleWorkspace(object): #
@classmethod
def join(cls, Ws, *p):
- Path = os.path.join(Ws, *p)
- if not os.path.exists(Path):
+ Path = Os.path.join(Ws, *p)
+ if not Os.path.exists(Path):
for Pkg in cls.PACKAGES_PATH:
- Path = os.path.join(Pkg, *p)
- if os.path.exists(Path):
+ Path = Os.path.join(Pkg, *p)
+ if Os.path.exists(Path):
return Path
- Path = os.path.join(Ws, *p)
+ Path = Os.path.join(Ws, *p)
return Path
## relpath()
@@ -87,10 +88,10 @@ class MultipleWorkspace(object): def relpath(cls, Path, Ws):
for Pkg in cls.PACKAGES_PATH:
if Path.lower().startswith(Pkg.lower()):
- Path = os.path.relpath(Path, Pkg)
+ Path = Os.path.relpath(Path, Pkg)
return Path
if Path.lower().startswith(Ws.lower()):
- Path = os.path.relpath(Path, Ws)
+ Path = Os.path.relpath(Path, Ws)
return Path
## getWs()
@@ -104,11 +105,11 @@ class MultipleWorkspace(object): #
@classmethod
def getWs(cls, Ws, Path):
- absPath = os.path.join(Ws, Path)
- if not os.path.exists(absPath):
+ absPath = Os.path.join(Ws, Path)
+ if not Os.path.exists(absPath):
for Pkg in cls.PACKAGES_PATH:
- absPath = os.path.join(Pkg, Path)
- if os.path.exists(absPath):
+ absPath = Os.path.join(Pkg, Path)
+ if Os.path.exists(absPath):
return Pkg
return Ws
@@ -129,10 +130,10 @@ class MultipleWorkspace(object): if MacroStartPos != -1:
Substr = str[MacroStartPos:]
Path = Substr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()
- if not os.path.exists(Path):
+ if not Os.path.exists(Path):
for Pkg in cls.PACKAGES_PATH:
Path = Substr.replace(TAB_WORKSPACE, Pkg).strip()
- if os.path.exists(Path):
+ if Os.path.exists(Path):
break
PathList[i] = str[0:MacroStartPos] + Path
PathStr = ' '.join(PathList)
@@ -147,4 +148,3 @@ class MultipleWorkspace(object): @classmethod
def getPkgPath(cls):
return cls.PACKAGES_PATH
-
|
