* [Patch V2 1/1] BaseTools: Change RealPath to AbsPath
@ 2021-09-29 8:43 Yuwei Chen
2021-10-08 15:11 ` Bob Feng
0 siblings, 1 reply; 2+ messages in thread
From: Yuwei Chen @ 2021-09-29 8:43 UTC (permalink / raw)
To: devel; +Cc: Bob Feng, Liming Gao
Currently the realpath is used when parse modules, which shows the
path with a drive letter in build log. In Windows 'subst' comand is
used to associates a path with a drive letter, when use the mapped
drive letter for build, with realpath function the build log will
have different disk letter info which will cause confusion. In this
situation, if use adspath function to show the path info, it will keep
same letter with the mapped drive letter, which avoids confusion.
This patch modifies the realpath to abspath.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
---
.gitignore | 1 +
BaseTools/Source/Python/Ecc/Check.py | 2 +-
BaseTools/Source/Python/Ecc/EccMain.py | 4 ++--
BaseTools/Source/Python/Ecc/c.py | 2 +-
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 4 ++--
BaseTools/Source/Python/GenFds/GenFds.py | 6 +++---
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1dd30c141066..41471df06ba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ Build/
__pycache__/
tags/
.vscode/
+/bin/
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 33060db5f27a..ba04e6e0619d 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -332,7 +332,7 @@ class Check(object):
for Dir in Dirnames:
Dirname = os.path.join(Dirpath, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirnames.remove(Dir)
diff --git a/BaseTools/Source/Python/Ecc/EccMain.py b/BaseTools/Source/Python/Ecc/EccMain.py
index 72edbea3b883..e7d44f57f1b4 100644
--- a/BaseTools/Source/Python/Ecc/EccMain.py
+++ b/BaseTools/Source/Python/Ecc/EccMain.py
@@ -105,7 +105,7 @@ class Ecc(object):
def InitDefaultConfigIni(self):
paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path)
- paths = (os.path.realpath('config.ini'),) + tuple(paths)
+ paths = (os.path.abspath('config.ini'),) + tuple(paths)
for path in paths:
if os.path.exists(path):
self.ConfigFile = path
@@ -183,7 +183,7 @@ class Ecc(object):
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir)
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 4a82e5e76003..313d6b088c12 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -508,7 +508,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
for Dir in dirnames:
Dirname = os.path.join(dirpath, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
dirnames.remove(Dir)
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 20573ca28d2f..568efb6d7685 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -707,8 +707,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
FileName,
'DEBUG'
)
- OutputPath = os.path.realpath(OutputPath)
- DebugPath = os.path.realpath(DebugPath)
+ OutputPath = os.path.abspath(OutputPath)
+ DebugPath = os.path.abspath(DebugPath)
return OutputPath, DebugPath
## __GenSimpleFileSection__() method
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index ae3e776a5540..7f266e163c73 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -153,7 +153,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
if FdfFilename[0:2] == '..':
- FdfFilename = os.path.realpath(FdfFilename)
+ FdfFilename = os.path.abspath(FdfFilename)
if not os.path.isabs(FdfFilename):
FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename):
@@ -175,7 +175,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)
if ActivePlatform[0:2] == '..':
- ActivePlatform = os.path.realpath(ActivePlatform)
+ ActivePlatform = os.path.abspath(ActivePlatform)
if not os.path.isabs (ActivePlatform):
ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
@@ -299,7 +299,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
for Key in GenFdsGlobalVariable.OutputDirDict:
OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
if OutputDir[0:2] == '..':
- OutputDir = os.path.realpath(OutputDir)
+ OutputDir = os.path.abspath(OutputDir)
if OutputDir[1] != ':':
OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
--
2.26.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch V2 1/1] BaseTools: Change RealPath to AbsPath
2021-09-29 8:43 [Patch V2 1/1] BaseTools: Change RealPath to AbsPath Yuwei Chen
@ 2021-10-08 15:11 ` Bob Feng
0 siblings, 0 replies; 2+ messages in thread
From: Bob Feng @ 2021-10-08 15:11 UTC (permalink / raw)
To: Chen, Christine, devel@edk2.groups.io; +Cc: Liming Gao
Hi Christine,
For the case that a directory is a symbol link, we should use os.path.realpath.
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
Thanks,
Bob
-----Original Message-----
From: Chen, Christine <yuwei.chen@intel.com>
Sent: Wednesday, September 29, 2021 4:44 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [Patch V2 1/1] BaseTools: Change RealPath to AbsPath
Currently the realpath is used when parse modules, which shows the path with a drive letter in build log. In Windows 'subst' comand is used to associates a path with a drive letter, when use the mapped drive letter for build, with realpath function the build log will have different disk letter info which will cause confusion. In this situation, if use adspath function to show the path info, it will keep same letter with the mapped drive letter, which avoids confusion.
This patch modifies the realpath to abspath.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
---
.gitignore | 1 +
BaseTools/Source/Python/Ecc/Check.py | 2 +-
BaseTools/Source/Python/Ecc/EccMain.py | 4 ++--
BaseTools/Source/Python/Ecc/c.py | 2 +-
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 4 ++--
BaseTools/Source/Python/GenFds/GenFds.py | 6 +++---
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1dd30c141066..41471df06ba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ Build/
__pycache__/
tags/
.vscode/
+/bin/
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 33060db5f27a..ba04e6e0619d 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -332,7 +332,7 @@ class Check(object):
for Dir in Dirnames:
Dirname = os.path.join(Dirpath, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirnames.remove(Dir) diff --git a/BaseTools/Source/Python/Ecc/EccMain.py b/BaseTools/Source/Python/Ecc/EccMain.py
index 72edbea3b883..e7d44f57f1b4 100644
--- a/BaseTools/Source/Python/Ecc/EccMain.py
+++ b/BaseTools/Source/Python/Ecc/EccMain.py
@@ -105,7 +105,7 @@ class Ecc(object):
def InitDefaultConfigIni(self):
paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path)
- paths = (os.path.realpath('config.ini'),) + tuple(paths)
+ paths = (os.path.abspath('config.ini'),) + tuple(paths)
for path in paths:
if os.path.exists(path):
self.ConfigFile = path
@@ -183,7 +183,7 @@ class Ecc(object):
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir) diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 4a82e5e76003..313d6b088c12 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -508,7 +508,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
for Dir in dirnames:
Dirname = os.path.join(dirpath, Dir)
if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
+ Dirname = os.path.abspath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
dirnames.remove(Dir) diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 20573ca28d2f..568efb6d7685 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -707,8 +707,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
FileName,
'DEBUG'
)
- OutputPath = os.path.realpath(OutputPath)
- DebugPath = os.path.realpath(DebugPath)
+ OutputPath = os.path.abspath(OutputPath)
+ DebugPath = os.path.abspath(DebugPath)
return OutputPath, DebugPath
## __GenSimpleFileSection__() method diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index ae3e776a5540..7f266e163c73 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -153,7 +153,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
if FdfFilename[0:2] == '..':
- FdfFilename = os.path.realpath(FdfFilename)
+ FdfFilename = os.path.abspath(FdfFilename)
if not os.path.isabs(FdfFilename):
FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename):
@@ -175,7 +175,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)
if ActivePlatform[0:2] == '..':
- ActivePlatform = os.path.realpath(ActivePlatform)
+ ActivePlatform = os.path.abspath(ActivePlatform)
if not os.path.isabs (ActivePlatform):
ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform) @@ -299,7 +299,7 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
for Key in GenFdsGlobalVariable.OutputDirDict:
OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
if OutputDir[0:2] == '..':
- OutputDir = os.path.realpath(OutputDir)
+ OutputDir = os.path.abspath(OutputDir)
if OutputDir[1] != ':':
OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
--
2.26.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-08 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-29 8:43 [Patch V2 1/1] BaseTools: Change RealPath to AbsPath Yuwei Chen
2021-10-08 15:11 ` Bob Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox