diff options
author | Bob Feng <bob.c.feng@intel.com> | 2021-07-28 19:45:23 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-08-02 03:52:15 +0000 |
commit | 03e77558d4939b9c21e94f03072360e9b00bb559 (patch) | |
tree | 06cea58d0104afb5711c7c7ae3dcf42d44ddde77 /BaseTools | |
parent | fc50df0d8eb5331b6641daeedd7f05ae75014ece (diff) | |
download | edk2-03e77558d4939b9c21e94f03072360e9b00bb559.zip edk2-03e77558d4939b9c21e94f03072360e9b00bb559.tar.gz edk2-03e77558d4939b9c21e94f03072360e9b00bb559.tar.bz2 |
BaseTools: use shutil.copyfile instead shutil.copy2
In Split tool, the copy file actions only need to
copy file content but not need to copy file metadata.
copy2() copies the file metadata that causes split
unit test failed under edk2-basetools CI environment.
So this patch changes the call of copy2() to copyfile().
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/Split/Split.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/Split/Split.py b/BaseTools/Source/Python/Split/Split.py index e223a72..e70d5c2 100644 --- a/BaseTools/Source/Python/Split/Split.py +++ b/BaseTools/Source/Python/Split/Split.py @@ -148,14 +148,14 @@ def splitFile(inputfile, position, outputdir=None, outputfile1=None, outputfile2 if position <= 0:
if outputfile2 != os.path.abspath(inputfile):
- shutil.copy2(os.path.abspath(inputfile), outputfile2)
+ shutil.copyfile(os.path.abspath(inputfile), outputfile2)
with open(outputfile1, "wb") as fout:
fout.write(b'')
else:
inputfilesize = getFileSize(inputfile)
if position >= inputfilesize:
if outputfile1 != os.path.abspath(inputfile):
- shutil.copy2(os.path.abspath(inputfile), outputfile1)
+ shutil.copyfile(os.path.abspath(inputfile), outputfile1)
with open(outputfile2, "wb") as fout:
fout.write(b'')
else:
@@ -171,8 +171,8 @@ def splitFile(inputfile, position, outputdir=None, outputfile1=None, outputfile2 content2 = fin.read(inputfilesize - position)
with open(tempfile2, "wb") as fout2:
fout2.write(content2)
- shutil.copy2(tempfile1, outputfile1)
- shutil.copy2(tempfile2, outputfile2)
+ shutil.copyfile(tempfile1, outputfile1)
+ shutil.copyfile(tempfile2, outputfile2)
except Exception as e:
logger.error("Split file failed")
raise(e)
|