fill_scrapyard.py: Pass a directory to tempfile.mkstemp()
PATCH 1/1 fill_scrapyard.py: Pass a directory to tempfile.mkstemp()
In some cases os.rename() may later fail due to "Cross-device link" issues. The easy way to deal with this is to simply make our temporary file here as well rather than TMPDIR.
--- scripts/fill_scrapyard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/fill_scrapyard.py +1 -1
@@ -119,7 +119,7 @@ class TmpFile: def __init__(self): """Constructor - create a temporary file""" - fd, self.filename = tempfile.mkstemp() + fd, self.filename = tempfile.mkstemp(dir='.') self.file = os.fdopen(fd, 'w') def __del__(self):
Signature · 1 line
1.7.9.5
PATCH 1/1 fill_scrapyard.py: Pass a directory to tempfile.mkstemp()
Hi Tom,
2015-10-19 23:56 GMT+09:00 Tom Rini <[email protected]>:
Quoted 15 lines
In some cases
os.rename()may later fail due to "Cross-device link" issues. The easy way to deal with this is to simply make our temporary file here as well rather than TMPDIR.Cc Masahiro Yamada <[email protected]>Signed-off-by Tom Rini <[email protected]>--- scripts/fill_scrapyard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/fill_scrapyard.py +0
-0
scripts/fill_scrapyard.py class TmpFile: · line 125
Quoted 8 lines
scripts/fill_scrapyard.py +1
-1@@ -119,7 +119,7 @@ class TmpFile: def __init__(self): """Constructor - create a temporary file""" - fd, self.filename = tempfile.mkstemp() + fd, self.filename = tempfile.mkstemp(dir='.') self.file = os.fdopen(fd, 'w') def __del__(self):
I personally prefer replacing "os.rename(tmpfile.filename, DOC)" with "shutil.move(tmpfile.filename, DOC)".
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/1 fill_scrapyard.py: Pass a directory to tempfile.mkstemp()
Quoted 26 lines · Masahiro Yamada
Hi Tom,
2015-10-19 23:56 GMT+09:00 Tom Rini <[email protected]>:
Quoted 22 lines
In some cases
os.rename()may later fail due to "Cross-device link" issues. The easy way to deal with this is to simply make our temporary file here as well rather than TMPDIR.Cc Masahiro Yamada <[email protected]>Signed-off-by Tom Rini <[email protected]>--- scripts/fill_scrapyard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/fill_scrapyard.py +1
-1@@ -119,7 +119,7 @@ class TmpFile: def __init__(self): """Constructor - create a temporary file""" - fd, self.filename = tempfile.mkstemp() + fd, self.filename = tempfile.mkstemp(dir='.') self.file = os.fdopen(fd, 'w')
Quoted 6 lines
scripts/fill_scrapyard.py class TmpFile: · line 125
Quoted 1 line
scripts/fill_scrapyard.py +0
-0def __del__(self):I personally prefer replacing "
os.rename(tmpfile.filename, DOC)" with "shutil.move(tmpfile.filename, DOC)".
Yeah, I saw that too but wasn't sure if we wanted to depend on that package.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151020/814ad17d/attachment.sig>