Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서승완
/
kappa
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Mitch Garnaat
2015-02-12 05:44:17 -0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
89b41b780d39de9f8051370b907c53c0d85a39e0
89b41b78
2 parents
31e69a65
076b2f84
Merge pull request #9 from ryansb/develop
Compress function zip file to save space/$$$
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
kappa/function.py
kappa/function.py
View file @
89b41b7
...
...
@@ -98,7 +98,8 @@ class Function(object):
LOG
.
debug
(
'_zip_lambda_dir: lambda_dir=
%
s'
,
lambda_dir
)
LOG
.
debug
(
'zipfile_name=
%
s'
,
zipfile_name
)
relroot
=
os
.
path
.
abspath
(
lambda_dir
)
with
zipfile
.
ZipFile
(
zipfile_name
,
'w'
)
as
zf
:
with
zipfile
.
ZipFile
(
zipfile_name
,
'w'
,
compression
=
zipfile
.
ZIP_DEFLATED
)
as
zf
:
for
root
,
dirs
,
files
in
os
.
walk
(
lambda_dir
):
zf
.
write
(
root
,
os
.
path
.
relpath
(
root
,
relroot
))
for
filename
in
files
:
...
...
@@ -111,7 +112,8 @@ class Function(object):
def
_zip_lambda_file
(
self
,
zipfile_name
,
lambda_file
):
LOG
.
debug
(
'_zip_lambda_file: lambda_file=
%
s'
,
lambda_file
)
LOG
.
debug
(
'zipfile_name=
%
s'
,
zipfile_name
)
with
zipfile
.
ZipFile
(
zipfile_name
,
'w'
)
as
zf
:
with
zipfile
.
ZipFile
(
zipfile_name
,
'w'
,
compression
=
zipfile
.
ZIP_DEFLATED
)
as
zf
:
zf
.
write
(
lambda_file
)
def
zip_lambda_function
(
self
,
zipfile_name
,
lambda_fn
):
...
...
Please
register
or
login
to post a comment