2626ZIPFILE_NAME = 'lambda_function.zip'
2727
2828
29- def build_package (path , requirements , virtualenv = None ):
29+ def build_package (path , requirements , virtualenv = None , ignore = [] ):
3030 pkg = Package (path , virtualenv )
3131
3232 pkg .clean_workspace ()
@@ -40,7 +40,7 @@ def build_package(path, requirements, virtualenv=None):
4040 LOG .info ('Building new virtualenv and installing requirements' )
4141 pkg .prepare_virtualenv ()
4242 pkg .install_requirements (requirements )
43- pkg .package ()
43+ pkg .package (ignore )
4444 return pkg
4545
4646
@@ -103,7 +103,7 @@ def install_requirements(self, requirements):
103103 if prc .returncode is not 0 :
104104 raise Exception ('pip returned unsuccessfully' )
105105
106- def package (self ):
106+ def package (self , ignore = [] ):
107107 package = os .path .join (self ._temp_workspace , 'lambda_package' )
108108
109109 # Copy site packages into package base
@@ -122,7 +122,9 @@ def package(self):
122122 LOG .info ('Copying lib64 site packages' )
123123 utils .copy_tree (lib64_path , package )
124124
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 )
126128 self ._create_zip (package )
127129
128130 def _create_zip (self , src ):
0 commit comments