Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seblu
installsystems
Commits
fe7d5b21
Commit
fe7d5b21
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
use PipeFile.consume() in place of shutil.copyfileobj
parent
147cab8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
installsystems/image.py
+3
-3
3 additions, 3 deletions
installsystems/image.py
installsystems/repository.py
+1
-1
1 addition, 1 deletion
installsystems/repository.py
with
4 additions
and
4 deletions
installsystems/image.py
+
3
−
3
View file @
fe7d5b21
...
...
@@ -415,7 +415,7 @@ class PackageImage(Image):
else
:
fileobj
=
PipeFile
(
mode
=
"
r
"
,
fileobj
=
fileobj
)
memfile
=
cStringIO
.
StringIO
()
shutil
.
copyfileobj
(
fileobj
,
memfile
)
fileobj
.
consume
(
memfile
)
# close source
fileobj
.
close
()
# get donwloaded size and md5
...
...
@@ -558,7 +558,7 @@ class PackageImage(Image):
raise
Exception
(
"
Downloading image %s failed: Invalid announced size
"
%
self
.
name
)
# open destination
fd
=
open
(
self
.
filename
,
"
wb
"
)
shutil
.
copyfileobj
(
fs
,
fd
)
fs
.
consume
(
fd
)
fs
.
close
()
fd
.
close
()
if
self
.
size
!=
fs
.
consumed_size
:
...
...
@@ -798,7 +798,7 @@ class Payload(object):
if
fs
.
size
is
not
None
and
self
.
size
!=
fs
.
size
:
raise
Exception
(
"
Downloading payload %s failed: Invalid announced size
"
%
self
.
name
)
fd
=
open
(
dest
,
"
wb
"
)
shutil
.
copyfileobj
(
fs
,
fd
)
fs
.
consume
(
fd
)
# closing fo
fs
.
close
()
fd
.
close
()
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
1
−
1
View file @
fe7d5b21
...
...
@@ -391,7 +391,7 @@ class Repository(object):
memfile
=
cStringIO
.
StringIO
()
try
:
fo
=
PipeFile
(
path
,
"
r
"
)
shutil
.
copyfileobj
(
fo
,
memfile
)
fo
.
consume
(
memfile
)
fo
.
close
()
except
Exception
as
e
:
raise
Exception
(
"
Loading image %s v%s failed: %s
"
%
(
name
,
version
,
e
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment