26
26
ZIPFILE_NAME = 'lambda_function.zip'
27
27
28
28
29
- def build_package (path , requirements , virtualenv = None ):
29
+ def build_package (path , requirements , virtualenv = None , ignore = [] ):
30
30
pkg = Package (path , virtualenv )
31
31
32
32
pkg .clean_workspace ()
@@ -40,7 +40,7 @@ def build_package(path, requirements, virtualenv=None):
40
40
LOG .info ('Building new virtualenv and installing requirements' )
41
41
pkg .prepare_virtualenv ()
42
42
pkg .install_requirements (requirements )
43
- pkg .package ()
43
+ pkg .package (ignore )
44
44
return pkg
45
45
46
46
@@ -103,7 +103,7 @@ def install_requirements(self, requirements):
103
103
if prc .returncode is not 0 :
104
104
raise Exception ('pip returned unsuccessfully' )
105
105
106
- def package (self ):
106
+ def package (self , ignore = [] ):
107
107
package = os .path .join (self ._temp_workspace , 'lambda_package' )
108
108
109
109
# Copy site packages into package base
@@ -122,7 +122,9 @@ def package(self):
122
122
LOG .info ('Copying lib64 site packages' )
123
123
utils .copy_tree (lib64_path , package )
124
124
125
- utils .copy_tree (self ._path , package , ignore = [TEMP_WORKSPACE_NAME ])
125
+ # Append the temp workspace to the ignore list
126
+ ignore .append ("^%s/*" % self ._temp_workspace )
127
+ utils .copy_tree (self ._path , package , ignore )
126
128
self ._create_zip (package )
127
129
128
130
def _create_zip (self , src ):
0 commit comments